50192023-04-09 20:55:40kohumarkKígyózó szavakcpp17Runtime error 30/10054ms63852 KiB
#include <iostream>
#include <vector>
using namespace std;
vector<string> t;
int h;

void szo(string act){
	if((int)act.length()<=h){
		t.push_back(act);
		if(act[act.length()-1]>('a')) szo(act+(char)(act[act.length()-1]-1));
		if(act[act.length()-1]<('z')) szo(act+(char)(act[act.length()-1]+1));
	}
}

void kigyozo(){
	for(char a='a'; a<='z'; a++){
		string x(1,a);
		szo(x);
	}
}

int main(){
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >> h >> n;
	kigyozo();
	for(int i=0; i<n; i++){
		int x; cin >> x;
		cout << t[x-1] << '\n';
	}
}
SubtaskSumTestVerdictTimeMemory
base30/100
1Accepted0/03ms1848 KiB
2Accepted0/03ms2276 KiB
3Accepted5/53ms2276 KiB
4Accepted5/52ms2364 KiB
5Accepted5/53ms2436 KiB
6Accepted5/53ms2720 KiB
7Accepted5/53ms3176 KiB
8Accepted5/54ms5108 KiB
9Runtime error0/550ms63852 KiB
10Runtime error0/548ms63612 KiB
11Runtime error0/546ms63388 KiB
12Runtime error0/545ms63360 KiB
13Runtime error0/537ms63124 KiB
14Runtime error0/654ms62876 KiB
15Runtime error0/639ms62644 KiB
16Runtime error0/646ms62400 KiB
17Runtime error0/646ms62400 KiB
18Runtime error0/746ms62392 KiB
19Runtime error0/737ms62372 KiB
20Runtime error0/750ms62256 KiB