#include <bits/stdc++.h>
#include "swaps.h"
using namespace std;
typedef long long ll;
typedef double ld;
#define pb push_back
#define sz(x) int(x.size())
#define all(x) x.begin(),x.end()
#define F first
#define S second
void solve(int n, int l) {
// TODO implement this function
vector<int> ret;
for (int i = 1; i <= n; i++) {
ret.pb(i);
}
for (int i = 0; i < l; i++) {
for (int j = (i & 1); j + 1 < n; j += 2) {
schedule(ret[j], ret[j+1]);
}
vector<int> v = visit();
for (int j = (i & 1), cur = 0; j + 1 < n; j += 2, cur++) {
if (!v[cur]) {
swap(ret[j], ret[j+1]);
}
}
}
answer(ret);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
344 KB |
Correct |
2 |
Correct |
83 ms |
344 KB |
Correct |
3 |
Correct |
166 ms |
344 KB |
Correct |
4 |
Correct |
323 ms |
1700 KB |
Correct |
5 |
Correct |
336 ms |
1340 KB |
Correct |
6 |
Correct |
311 ms |
1424 KB |
Correct |
7 |
Correct |
318 ms |
1420 KB |
Correct |
8 |
Correct |
322 ms |
1556 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
344 KB |
Correct |
2 |
Correct |
76 ms |
540 KB |
Correct |
3 |
Correct |
166 ms |
344 KB |
Correct |
4 |
Correct |
324 ms |
1528 KB |
Correct |
5 |
Correct |
322 ms |
1440 KB |
Correct |
6 |
Correct |
317 ms |
1544 KB |
Correct |
7 |
Correct |
317 ms |
1488 KB |
Correct |
8 |
Correct |
319 ms |
1596 KB |
Correct |
9 |
Correct |
63 ms |
664 KB |
Correct |
10 |
Correct |
62 ms |
1424 KB |
Correct |
11 |
Correct |
62 ms |
1164 KB |
Correct |
12 |
Correct |
63 ms |
1424 KB |
Correct |
13 |
Correct |
66 ms |
1168 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
344 KB |
Correct |
2 |
Correct |
76 ms |
344 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
344 KB |
Correct |
2 |
Correct |
76 ms |
344 KB |
Correct |
3 |
Correct |
29 ms |
344 KB |
Correct |
4 |
Correct |
76 ms |
344 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
344 KB |
Correct |
2 |
Correct |
74 ms |
344 KB |
Correct |
3 |
Correct |
167 ms |
340 KB |
Correct |
4 |
Correct |
318 ms |
1668 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
344 KB |
Correct |
2 |
Correct |
74 ms |
344 KB |
Correct |
3 |
Correct |
167 ms |
340 KB |
Correct |
4 |
Correct |
318 ms |
1668 KB |
Correct |
5 |
Correct |
36 ms |
344 KB |
Correct |
6 |
Correct |
88 ms |
344 KB |
Correct |
7 |
Correct |
173 ms |
344 KB |
Correct |
8 |
Correct |
321 ms |
1660 KB |
Correct |
9 |
Correct |
324 ms |
1448 KB |
Correct |
10 |
Correct |
334 ms |
1672 KB |
Correct |
11 |
Correct |
337 ms |
1328 KB |
Correct |
12 |
Correct |
313 ms |
1744 KB |
Correct |
13 |
Correct |
29 ms |
344 KB |
Correct |
14 |
Correct |
77 ms |
344 KB |
Correct |
15 |
Correct |
169 ms |
344 KB |
Correct |
16 |
Correct |
324 ms |
1520 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
344 KB |
Correct |
2 |
Correct |
78 ms |
344 KB |
Correct |
3 |
Correct |
168 ms |
344 KB |
Correct |
4 |
Correct |
310 ms |
1296 KB |
Correct |
5 |
Correct |
31 ms |
1192 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
344 KB |
Correct |
2 |
Correct |
78 ms |
344 KB |
Correct |
3 |
Correct |
168 ms |
344 KB |
Correct |
4 |
Correct |
310 ms |
1296 KB |
Correct |
5 |
Correct |
31 ms |
1192 KB |
Correct |
6 |
Correct |
26 ms |
344 KB |
Correct |
7 |
Correct |
74 ms |
344 KB |
Correct |
8 |
Correct |
164 ms |
344 KB |
Correct |
9 |
Correct |
320 ms |
1364 KB |
Correct |
10 |
Correct |
313 ms |
1624 KB |
Correct |
11 |
Correct |
319 ms |
1384 KB |
Correct |
12 |
Correct |
318 ms |
1884 KB |
Correct |
13 |
Correct |
450 ms |
1848 KB |
Correct |
14 |
Correct |
67 ms |
692 KB |
Correct |
15 |
Correct |
62 ms |
1172 KB |
Correct |
16 |
Correct |
62 ms |
1176 KB |
Correct |
17 |
Correct |
71 ms |
1420 KB |
Correct |
18 |
Correct |
64 ms |
1172 KB |
Correct |
19 |
Correct |
25 ms |
344 KB |
Correct |
20 |
Correct |
81 ms |
344 KB |
Correct |
21 |
Correct |
168 ms |
344 KB |
Correct |
22 |
Correct |
324 ms |
1492 KB |
Correct |
23 |
Correct |
35 ms |
932 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
344 KB |
Correct |
2 |
Correct |
75 ms |
344 KB |
Correct |
3 |
Correct |
192 ms |
344 KB |
Correct |
4 |
Correct |
320 ms |
1608 KB |
Correct |
5 |
Correct |
32 ms |
1172 KB |
Correct |
6 |
Incorrect |
8 ms |
836 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
344 KB |
Correct |
2 |
Correct |
75 ms |
344 KB |
Correct |
3 |
Correct |
192 ms |
344 KB |
Correct |
4 |
Correct |
320 ms |
1608 KB |
Correct |
5 |
Correct |
32 ms |
1172 KB |
Correct |
6 |
Incorrect |
8 ms |
836 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
344 KB |
Correct |
2 |
Correct |
78 ms |
344 KB |
Correct |
3 |
Correct |
236 ms |
344 KB |
Correct |
4 |
Correct |
318 ms |
1804 KB |
Correct |
5 |
Correct |
31 ms |
1188 KB |
Correct |
6 |
Incorrect |
7 ms |
412 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
344 KB |
Correct |
2 |
Correct |
78 ms |
344 KB |
Correct |
3 |
Correct |
236 ms |
344 KB |
Correct |
4 |
Correct |
318 ms |
1804 KB |
Correct |
5 |
Correct |
31 ms |
1188 KB |
Correct |
6 |
Incorrect |
7 ms |
412 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |