#include <bits/stdc++.h>
using namespace std;
int main()
{
int a , b ;
cin>>a>>b ;
string ans = "" ;
for(int i = 0 ; i < 9 ; ++i)
ans += (char)('a' + i) ;
int stop = max(a , (b+1)/2);
int cnt = 0 ;
do
{
cout<<ans<<" ";
cnt++;
if(cnt == stop)
return 0 ;
}
while(next_permutation(ans.begin() , ans.end()));
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
3 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
760 KB |
Output is correct |
8 |
Correct |
8 ms |
1144 KB |
Output is correct |
9 |
Correct |
9 ms |
1272 KB |
Output is correct |
10 |
Correct |
5 ms |
888 KB |
Output is correct |