Submission #25199885
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define U 998244353
#define N 1000005
#define int long long
#define sz(c) (int)c.size()
#define fr first
#define ll long long
#define sc second
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a ; i<n ; i++)
#define r0 return 0;
#define endl '\n'
#define INF (int)1e15
/* Debug Begins */
# define trace(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(bool f) { if(f) return "True"; else return "False";}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
template<typename A, typename B> string to_string(pair<A, B> p){
return "(" + to_string(p.first) + ": " + to_string(p.second) + ")";}
template<typename A> string to_string(A v) {bool f = false; string r = "{";
for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r;
for (auto x: v) r += "\n" + to_string(x); return r;}
int Nerr;
template<typename A> string to_string(A *p) {return to_string(vector<A>(p, p + Nerr));}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
cerr << *it << " = " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
#define Lu(...) [&] (auto &&u) { return __VA_ARGS__; }
#define Luv(...) [&] (auto &&u, auto &&v) { return __VA_ARGS__; }
/***************************************************************/
signed main()
{
ios_base::sync_with_stdio(0);
int TESTS=1;
// cin>>TESTS;
while(TESTS--)
{
string s;
cin >> s;
sort(all(s));
int k;
cin >> k;
set<string> ss;
do {
ss.insert(s);
} while(next_permutation(all(s)));
std::set<string>::iterator it = ss.begin();
std::advance(it, k-1);
cout << *it << endl;
}
}
Submission Info
Submission Time
2021-08-21 21:03:59+0900
Task
C - One More aab aba baa
User
adarshagr8
Language
C++ (GCC 9.2.1)
Score
300
Code Size
2389 Byte
Status
AC
Exec Time
26 ms
Memory
6756 KiB
Compile Error
./Main.cpp: In function ‘std::string to_string(std::vector<std::vector<_Tp> >)’:
./Main.cpp:33:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
33 | for (auto x: v) r += "\n" + to_string(x); return r;}
| ^~~
./Main.cpp:33:45: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
33 | for (auto x: v) r += "\n" + to_string(x); return r;}
| ^~~~~~
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
300 / 300
Status
Set Name
Test Cases
Sample
sample_01.txt, sample_02.txt, sample_03.txt
All
sample_01.txt, sample_02.txt, sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt
Case Name
Status
Exec Time
Memory
sample_01.txt
AC
8 ms
3660 KiB
sample_02.txt
AC
3 ms
3508 KiB
sample_03.txt
AC
26 ms
6756 KiB
test_01.txt
AC
3 ms
3604 KiB
test_02.txt
AC
2 ms
3620 KiB
test_03.txt
AC
3 ms
3556 KiB
test_04.txt
AC
2 ms
3464 KiB
test_05.txt
AC
2 ms
3508 KiB
test_06.txt
AC
2 ms
3536 KiB
test_07.txt
AC
5 ms
4012 KiB
test_08.txt
AC
2 ms
3556 KiB
test_09.txt
AC
20 ms
6612 KiB
test_10.txt
AC
19 ms
6736 KiB
test_11.txt
AC
19 ms
6608 KiB
test_12.txt
AC
5 ms
3784 KiB
test_13.txt
AC
17 ms
5092 KiB
test_14.txt
AC
2 ms
3512 KiB
test_15.txt
AC
3 ms
3644 KiB
test_16.txt
AC
3 ms
3848 KiB