#include "swaps.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> v;
void solve(int N,int V){
for(int i=1;i<=N;++i){
v.push_back(i);
}
int par=0;
for(int it=0;it<V;++it){
for(int i=par;i+1<N;i+=2){
schedule(v[i],v[i+1]);
}
auto res=visit();
reverse(res.begin(),res.end());
for(int i=par;i+1<N;i+=2){
if(res.back()==0)swap(v[i],v[i+1]);
res.pop_back();
}
par=1-par;
}
answer(v);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
208 KB |
Correct |
2 |
Correct |
96 ms |
208 KB |
Correct |
3 |
Correct |
217 ms |
208 KB |
Correct |
4 |
Correct |
415 ms |
448 KB |
Correct |
5 |
Correct |
409 ms |
352 KB |
Correct |
6 |
Correct |
395 ms |
408 KB |
Correct |
7 |
Correct |
394 ms |
404 KB |
Correct |
8 |
Correct |
399 ms |
480 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
45 ms |
208 KB |
Correct |
2 |
Correct |
105 ms |
208 KB |
Correct |
3 |
Correct |
229 ms |
208 KB |
Correct |
4 |
Correct |
405 ms |
408 KB |
Correct |
5 |
Correct |
418 ms |
372 KB |
Correct |
6 |
Correct |
403 ms |
360 KB |
Correct |
7 |
Correct |
444 ms |
408 KB |
Correct |
8 |
Correct |
445 ms |
404 KB |
Correct |
9 |
Correct |
87 ms |
304 KB |
Correct |
10 |
Correct |
93 ms |
440 KB |
Correct |
11 |
Correct |
74 ms |
368 KB |
Correct |
12 |
Correct |
78 ms |
332 KB |
Correct |
13 |
Correct |
75 ms |
364 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
49 ms |
208 KB |
Correct |
2 |
Correct |
110 ms |
208 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
49 ms |
208 KB |
Correct |
2 |
Correct |
110 ms |
208 KB |
Correct |
3 |
Correct |
36 ms |
208 KB |
Correct |
4 |
Correct |
124 ms |
316 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
45 ms |
208 KB |
Correct |
2 |
Correct |
110 ms |
208 KB |
Correct |
3 |
Correct |
244 ms |
208 KB |
Correct |
4 |
Correct |
403 ms |
404 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
45 ms |
208 KB |
Correct |
2 |
Correct |
110 ms |
208 KB |
Correct |
3 |
Correct |
244 ms |
208 KB |
Correct |
4 |
Correct |
403 ms |
404 KB |
Correct |
5 |
Correct |
51 ms |
208 KB |
Correct |
6 |
Correct |
109 ms |
208 KB |
Correct |
7 |
Correct |
222 ms |
208 KB |
Correct |
8 |
Correct |
420 ms |
492 KB |
Correct |
9 |
Correct |
386 ms |
392 KB |
Correct |
10 |
Correct |
396 ms |
396 KB |
Correct |
11 |
Correct |
423 ms |
388 KB |
Correct |
12 |
Correct |
394 ms |
432 KB |
Correct |
13 |
Correct |
55 ms |
208 KB |
Correct |
14 |
Correct |
132 ms |
296 KB |
Correct |
15 |
Correct |
270 ms |
208 KB |
Correct |
16 |
Correct |
411 ms |
404 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
43 ms |
208 KB |
Correct |
2 |
Correct |
83 ms |
296 KB |
Correct |
3 |
Correct |
215 ms |
208 KB |
Correct |
4 |
Correct |
427 ms |
528 KB |
Correct |
5 |
Correct |
50 ms |
316 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
43 ms |
208 KB |
Correct |
2 |
Correct |
83 ms |
296 KB |
Correct |
3 |
Correct |
215 ms |
208 KB |
Correct |
4 |
Correct |
427 ms |
528 KB |
Correct |
5 |
Correct |
50 ms |
316 KB |
Correct |
6 |
Correct |
46 ms |
208 KB |
Correct |
7 |
Correct |
117 ms |
208 KB |
Correct |
8 |
Correct |
219 ms |
208 KB |
Correct |
9 |
Correct |
393 ms |
576 KB |
Correct |
10 |
Correct |
398 ms |
420 KB |
Correct |
11 |
Correct |
400 ms |
488 KB |
Correct |
12 |
Correct |
432 ms |
372 KB |
Correct |
13 |
Correct |
418 ms |
412 KB |
Correct |
14 |
Correct |
90 ms |
356 KB |
Correct |
15 |
Correct |
78 ms |
376 KB |
Correct |
16 |
Correct |
78 ms |
324 KB |
Correct |
17 |
Correct |
79 ms |
304 KB |
Correct |
18 |
Correct |
81 ms |
380 KB |
Correct |
19 |
Correct |
58 ms |
208 KB |
Correct |
20 |
Correct |
100 ms |
208 KB |
Correct |
21 |
Correct |
236 ms |
208 KB |
Correct |
22 |
Correct |
449 ms |
404 KB |
Correct |
23 |
Correct |
42 ms |
304 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
208 KB |
Correct |
2 |
Correct |
115 ms |
208 KB |
Correct |
3 |
Correct |
214 ms |
208 KB |
Correct |
4 |
Correct |
389 ms |
492 KB |
Correct |
5 |
Correct |
40 ms |
300 KB |
Correct |
6 |
Incorrect |
8 ms |
280 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
208 KB |
Correct |
2 |
Correct |
115 ms |
208 KB |
Correct |
3 |
Correct |
214 ms |
208 KB |
Correct |
4 |
Correct |
389 ms |
492 KB |
Correct |
5 |
Correct |
40 ms |
300 KB |
Correct |
6 |
Incorrect |
8 ms |
280 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
59 ms |
208 KB |
Correct |
2 |
Correct |
118 ms |
208 KB |
Correct |
3 |
Correct |
240 ms |
208 KB |
Correct |
4 |
Correct |
383 ms |
588 KB |
Correct |
5 |
Correct |
56 ms |
304 KB |
Correct |
6 |
Incorrect |
12 ms |
280 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
59 ms |
208 KB |
Correct |
2 |
Correct |
118 ms |
208 KB |
Correct |
3 |
Correct |
240 ms |
208 KB |
Correct |
4 |
Correct |
383 ms |
588 KB |
Correct |
5 |
Correct |
56 ms |
304 KB |
Correct |
6 |
Incorrect |
12 ms |
280 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |