#include "swaps.h"
#include <bits/stdc++.h>
#define sz(a) (int)(a.size())
using namespace std;
void solve(int n,int V){
vector<int>ans;
for(int i=1;i<=n;i++)ans.push_back(i);
for(int i=0;i<n;i++){
int c = 0;
if(i&1){
for(int j=0;j+1<n;j+=2)schedule(ans[j],ans[j+1]);
vector<int>res = visit();
for(int j=0;j+1<n;j+=2){
if(res[c])swap(ans[j],ans[j+1]);
c++;
}
}else{
for(int j=1;j+1<n;j+=2)schedule(ans[j],ans[j+1]);
vector<int>res = visit();
for(int j=1;j+1<n;j+=2){
if(res[c])swap(ans[j],ans[j+1]);
c++;
}
}
}
reverse(ans.begin(),ans.end());
answer(ans);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Correct |
2 |
Correct |
2 ms |
208 KB |
Correct |
3 |
Correct |
12 ms |
208 KB |
Correct |
4 |
Correct |
45 ms |
304 KB |
Correct |
5 |
Correct |
40 ms |
300 KB |
Correct |
6 |
Correct |
36 ms |
304 KB |
Correct |
7 |
Correct |
52 ms |
404 KB |
Correct |
8 |
Correct |
37 ms |
304 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Correct |
2 |
Correct |
2 ms |
208 KB |
Correct |
3 |
Correct |
14 ms |
208 KB |
Correct |
4 |
Correct |
45 ms |
308 KB |
Correct |
5 |
Correct |
34 ms |
304 KB |
Correct |
6 |
Correct |
41 ms |
304 KB |
Correct |
7 |
Correct |
39 ms |
304 KB |
Correct |
8 |
Correct |
39 ms |
304 KB |
Correct |
9 |
Correct |
58 ms |
304 KB |
Correct |
10 |
Correct |
39 ms |
296 KB |
Correct |
11 |
Correct |
39 ms |
304 KB |
Correct |
12 |
Correct |
40 ms |
304 KB |
Correct |
13 |
Correct |
40 ms |
300 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Correct |
2 |
Correct |
3 ms |
208 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Correct |
2 |
Correct |
3 ms |
208 KB |
Correct |
3 |
Correct |
1 ms |
208 KB |
Correct |
4 |
Correct |
4 ms |
208 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Correct |
2 |
Correct |
2 ms |
208 KB |
Correct |
3 |
Correct |
11 ms |
208 KB |
Correct |
4 |
Correct |
37 ms |
304 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Correct |
2 |
Correct |
2 ms |
208 KB |
Correct |
3 |
Correct |
11 ms |
208 KB |
Correct |
4 |
Correct |
37 ms |
304 KB |
Correct |
5 |
Correct |
1 ms |
208 KB |
Correct |
6 |
Correct |
3 ms |
208 KB |
Correct |
7 |
Correct |
16 ms |
208 KB |
Correct |
8 |
Correct |
47 ms |
492 KB |
Correct |
9 |
Correct |
41 ms |
304 KB |
Correct |
10 |
Correct |
38 ms |
532 KB |
Correct |
11 |
Correct |
58 ms |
304 KB |
Correct |
12 |
Correct |
45 ms |
444 KB |
Correct |
13 |
Correct |
1 ms |
208 KB |
Correct |
14 |
Correct |
3 ms |
208 KB |
Correct |
15 |
Correct |
16 ms |
208 KB |
Correct |
16 |
Correct |
42 ms |
304 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Correct |
2 |
Correct |
3 ms |
208 KB |
Correct |
3 |
Correct |
16 ms |
208 KB |
Correct |
4 |
Correct |
43 ms |
300 KB |
Correct |
5 |
Correct |
43 ms |
292 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Correct |
2 |
Correct |
3 ms |
208 KB |
Correct |
3 |
Correct |
16 ms |
208 KB |
Correct |
4 |
Correct |
43 ms |
300 KB |
Correct |
5 |
Correct |
43 ms |
292 KB |
Correct |
6 |
Correct |
0 ms |
208 KB |
Correct |
7 |
Correct |
3 ms |
208 KB |
Correct |
8 |
Correct |
16 ms |
208 KB |
Correct |
9 |
Correct |
41 ms |
408 KB |
Correct |
10 |
Correct |
56 ms |
300 KB |
Correct |
11 |
Correct |
39 ms |
296 KB |
Correct |
12 |
Correct |
40 ms |
368 KB |
Correct |
13 |
Correct |
39 ms |
312 KB |
Correct |
14 |
Correct |
39 ms |
300 KB |
Correct |
15 |
Correct |
39 ms |
316 KB |
Correct |
16 |
Correct |
36 ms |
328 KB |
Correct |
17 |
Correct |
38 ms |
304 KB |
Correct |
18 |
Correct |
38 ms |
304 KB |
Correct |
19 |
Correct |
1 ms |
208 KB |
Correct |
20 |
Correct |
3 ms |
292 KB |
Correct |
21 |
Correct |
13 ms |
208 KB |
Correct |
22 |
Correct |
40 ms |
300 KB |
Correct |
23 |
Correct |
41 ms |
300 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Correct |
2 |
Correct |
3 ms |
208 KB |
Correct |
3 |
Correct |
12 ms |
208 KB |
Correct |
4 |
Correct |
40 ms |
308 KB |
Correct |
5 |
Correct |
57 ms |
304 KB |
Correct |
6 |
Runtime error |
9 ms |
276 KB |
Execution killed with signal 13 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Correct |
2 |
Correct |
3 ms |
208 KB |
Correct |
3 |
Correct |
12 ms |
208 KB |
Correct |
4 |
Correct |
40 ms |
308 KB |
Correct |
5 |
Correct |
57 ms |
304 KB |
Correct |
6 |
Runtime error |
9 ms |
276 KB |
Execution killed with signal 13 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Correct |
2 |
Correct |
2 ms |
208 KB |
Correct |
3 |
Correct |
12 ms |
208 KB |
Correct |
4 |
Correct |
50 ms |
304 KB |
Correct |
5 |
Correct |
40 ms |
380 KB |
Correct |
6 |
Runtime error |
8 ms |
280 KB |
Execution killed with signal 13 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Correct |
2 |
Correct |
2 ms |
208 KB |
Correct |
3 |
Correct |
12 ms |
208 KB |
Correct |
4 |
Correct |
50 ms |
304 KB |
Correct |
5 |
Correct |
40 ms |
380 KB |
Correct |
6 |
Runtime error |
8 ms |
280 KB |
Execution killed with signal 13 |
7 |
Halted |
0 ms |
0 KB |
- |