#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define pb push_back
#define sz(a) (int)a.size()
#define vec(...) vector<__VA_ARGS__>
#define _3Pxrs5V ios::sync_with_stdio(0),cin.tie(0)
typedef long long ll;
using pii=pair<int,int>;
using vi=vector<int>;
void print(){cout<<'\n';}
template<class h,class...t>
void print(const h&v,const t&...u){cout<<v<<' ',print(u...);}
//e
vec(string) basis;
void fill_basis(string s){
if(sz(s)>4){
return;
}
if(sz(s)){
basis.pb(s);
}
rep(ch,26){
s+=(char)(ch+'a');
fill_basis(s);
s.pop_back();
}
}
signed main(){
_3Pxrs5V;
fill_basis("");
int l,r;
cin>>l>>r;
while(sz(basis)>r){
basis.pop_back();
}
for(auto s:basis){
cout<<s<<" ";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
281 ms |
16796 KB |
Output is correct |
2 |
Correct |
275 ms |
16988 KB |
Output is correct |
3 |
Correct |
291 ms |
16940 KB |
Output is correct |
4 |
Correct |
279 ms |
16796 KB |
Output is correct |
5 |
Correct |
281 ms |
16804 KB |
Output is correct |
6 |
Correct |
288 ms |
16788 KB |
Output is correct |
7 |
Correct |
282 ms |
16828 KB |
Output is correct |
8 |
Correct |
298 ms |
16768 KB |
Output is correct |
9 |
Correct |
274 ms |
16868 KB |
Output is correct |
10 |
Correct |
297 ms |
16824 KB |
Output is correct |