//
// --- Sample implementation for the task swaps ---
//
// To compile this program with the sample grader, place:
// swaps.h swaps_sample.cpp sample_grader.cpp
// in a single folder and run:
// g++ swaps_sample.cpp sample_grader.cpp
// in this folder.
//
#include "swaps.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define vb vector<bool>
#define vi vector<int>
#define vpii vector<pii>
#define vvb vector<vb>
#define vvi vector<vi>
#define vvpii vector<vpii>
#define sz(x) (int)(x).size()
int N, V;
void solve(int _N, int _V)
{
N = _N, V = _V;
vi ans;
for (int i = 1; i <= N; ++i)
ans.push_back(i);
bool offset = 0;
for (int foo = 0; foo < V; ++foo)
{
for (int idx = offset; idx < N - 1; idx += 2)
schedule(ans[idx], ans[idx + 1]);
vi comp = visit();
for (int idx = offset; idx < N - 1; idx += 2)
if (!comp[idx / 2])
swap(ans[idx], ans[idx + 1]);
offset = (offset + 1) % 2;
}
answer(ans);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
54 ms |
208 KB |
Correct |
2 |
Correct |
122 ms |
208 KB |
Correct |
3 |
Correct |
243 ms |
208 KB |
Correct |
4 |
Correct |
478 ms |
528 KB |
Correct |
5 |
Correct |
447 ms |
408 KB |
Correct |
6 |
Correct |
431 ms |
404 KB |
Correct |
7 |
Correct |
435 ms |
408 KB |
Correct |
8 |
Correct |
449 ms |
536 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
47 ms |
208 KB |
Correct |
2 |
Correct |
95 ms |
208 KB |
Correct |
3 |
Correct |
229 ms |
208 KB |
Correct |
4 |
Correct |
450 ms |
404 KB |
Correct |
5 |
Correct |
468 ms |
384 KB |
Correct |
6 |
Correct |
436 ms |
380 KB |
Correct |
7 |
Correct |
410 ms |
404 KB |
Correct |
8 |
Correct |
449 ms |
572 KB |
Correct |
9 |
Correct |
84 ms |
400 KB |
Correct |
10 |
Correct |
96 ms |
408 KB |
Correct |
11 |
Correct |
81 ms |
424 KB |
Correct |
12 |
Correct |
87 ms |
372 KB |
Correct |
13 |
Correct |
87 ms |
384 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
58 ms |
208 KB |
Correct |
2 |
Correct |
98 ms |
208 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
58 ms |
208 KB |
Correct |
2 |
Correct |
98 ms |
208 KB |
Correct |
3 |
Correct |
52 ms |
208 KB |
Correct |
4 |
Correct |
112 ms |
208 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
53 ms |
208 KB |
Correct |
2 |
Correct |
118 ms |
208 KB |
Correct |
3 |
Correct |
223 ms |
208 KB |
Correct |
4 |
Correct |
414 ms |
452 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
53 ms |
208 KB |
Correct |
2 |
Correct |
118 ms |
208 KB |
Correct |
3 |
Correct |
223 ms |
208 KB |
Correct |
4 |
Correct |
414 ms |
452 KB |
Correct |
5 |
Correct |
49 ms |
208 KB |
Correct |
6 |
Correct |
120 ms |
208 KB |
Correct |
7 |
Correct |
220 ms |
208 KB |
Correct |
8 |
Correct |
442 ms |
404 KB |
Correct |
9 |
Correct |
384 ms |
528 KB |
Correct |
10 |
Correct |
451 ms |
428 KB |
Correct |
11 |
Correct |
426 ms |
468 KB |
Correct |
12 |
Correct |
449 ms |
520 KB |
Correct |
13 |
Correct |
52 ms |
208 KB |
Correct |
14 |
Correct |
105 ms |
208 KB |
Correct |
15 |
Correct |
241 ms |
208 KB |
Correct |
16 |
Correct |
447 ms |
440 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
45 ms |
208 KB |
Correct |
2 |
Correct |
124 ms |
208 KB |
Correct |
3 |
Correct |
212 ms |
208 KB |
Correct |
4 |
Correct |
399 ms |
392 KB |
Correct |
5 |
Correct |
44 ms |
396 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
45 ms |
208 KB |
Correct |
2 |
Correct |
124 ms |
208 KB |
Correct |
3 |
Correct |
212 ms |
208 KB |
Correct |
4 |
Correct |
399 ms |
392 KB |
Correct |
5 |
Correct |
44 ms |
396 KB |
Correct |
6 |
Correct |
35 ms |
208 KB |
Correct |
7 |
Correct |
144 ms |
208 KB |
Correct |
8 |
Correct |
250 ms |
208 KB |
Correct |
9 |
Correct |
434 ms |
536 KB |
Correct |
10 |
Correct |
407 ms |
480 KB |
Correct |
11 |
Correct |
454 ms |
620 KB |
Correct |
12 |
Correct |
461 ms |
472 KB |
Correct |
13 |
Correct |
460 ms |
488 KB |
Correct |
14 |
Correct |
82 ms |
468 KB |
Correct |
15 |
Correct |
97 ms |
300 KB |
Correct |
16 |
Correct |
88 ms |
392 KB |
Correct |
17 |
Correct |
91 ms |
360 KB |
Correct |
18 |
Correct |
86 ms |
384 KB |
Correct |
19 |
Correct |
62 ms |
208 KB |
Correct |
20 |
Correct |
122 ms |
208 KB |
Correct |
21 |
Correct |
245 ms |
208 KB |
Correct |
22 |
Correct |
440 ms |
360 KB |
Correct |
23 |
Correct |
46 ms |
288 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
53 ms |
208 KB |
Correct |
2 |
Correct |
112 ms |
208 KB |
Correct |
3 |
Correct |
240 ms |
208 KB |
Correct |
4 |
Correct |
430 ms |
332 KB |
Correct |
5 |
Correct |
47 ms |
308 KB |
Correct |
6 |
Incorrect |
8 ms |
284 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
53 ms |
208 KB |
Correct |
2 |
Correct |
112 ms |
208 KB |
Correct |
3 |
Correct |
240 ms |
208 KB |
Correct |
4 |
Correct |
430 ms |
332 KB |
Correct |
5 |
Correct |
47 ms |
308 KB |
Correct |
6 |
Incorrect |
8 ms |
284 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
51 ms |
208 KB |
Correct |
2 |
Correct |
132 ms |
208 KB |
Correct |
3 |
Correct |
236 ms |
208 KB |
Correct |
4 |
Correct |
440 ms |
404 KB |
Correct |
5 |
Correct |
64 ms |
400 KB |
Correct |
6 |
Incorrect |
9 ms |
280 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
51 ms |
208 KB |
Correct |
2 |
Correct |
132 ms |
208 KB |
Correct |
3 |
Correct |
236 ms |
208 KB |
Correct |
4 |
Correct |
440 ms |
404 KB |
Correct |
5 |
Correct |
64 ms |
400 KB |
Correct |
6 |
Incorrect |
9 ms |
280 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |