50182023-04-09 20:50:37kohumarkKígyózó szavakcpp17Wrong answer 0/10054ms63680 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];
	}
}
SubtaskSumTestVerdictTimeMemory
base0/100
1Wrong answer0/03ms1840 KiB
2Wrong answer0/03ms2256 KiB
3Wrong answer0/53ms2236 KiB
4Wrong answer0/53ms2468 KiB
5Wrong answer0/53ms2840 KiB
6Wrong answer0/53ms2812 KiB
7Wrong answer0/53ms3272 KiB
8Wrong answer0/54ms5276 KiB
9Runtime error0/545ms63680 KiB
10Runtime error0/552ms63448 KiB
11Runtime error0/539ms63212 KiB
12Runtime error0/539ms63120 KiB
13Runtime error0/532ms62884 KiB
14Runtime error0/652ms62868 KiB
15Runtime error0/643ms62864 KiB
16Runtime error0/648ms62852 KiB
17Runtime error0/654ms62620 KiB
18Runtime error0/752ms62384 KiB
19Runtime error0/739ms62384 KiB
20Runtime error0/750ms62372 KiB