#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pb emplace_back
#define AI(i) begin(i), end(i)
template<class T> bool chmin(T &a, T b) { return b < a && (a = b, true); }
template<class T> bool chmax(T &a, T b) { return a < b && (a = b, true); }
#ifdef KEV
#define DE(args...) kout("[ " + string(#args) + " ] = ", args)
void kout() { cerr << endl; }
template<class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ', kout(b...); }
template<class T> void debug(T l, T r) { while (l != r) cerr << *l << " \n"[next(l)==r], ++l; }
#else
#define DE(...) 0
#define debug(...) 0
#endif
#include "swaps.h"
const int MAX_N = 300010;
void solve(int N, int V) {
vector<int> id(N); iota(AI(id), 1);
for (int i = 0;i < V;++i) {
vector<pair<int,int>> comp;
for (int j = i&1;j+1 < N;j += 2) {
schedule(id[j], id[j+1]);
comp.pb(j, j+1);
}
vector<int> ret = visit();
for (int j = 0;j < ret.size();++j) {
if (ret[j] == 0) {
auto [x, y] = comp[j];
swap(id[x], id[y]);
}
}
}
answer(id);
}
Compilation message
swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:32:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
32 | for (int j = 0;j < ret.size();++j) {
| ~~^~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
55 ms |
200 KB |
Correct |
2 |
Correct |
144 ms |
276 KB |
Correct |
3 |
Correct |
280 ms |
200 KB |
Correct |
4 |
Correct |
520 ms |
364 KB |
Correct |
5 |
Correct |
502 ms |
472 KB |
Correct |
6 |
Correct |
528 ms |
448 KB |
Correct |
7 |
Correct |
512 ms |
476 KB |
Correct |
8 |
Correct |
525 ms |
428 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
63 ms |
200 KB |
Correct |
2 |
Correct |
135 ms |
276 KB |
Correct |
3 |
Correct |
279 ms |
200 KB |
Correct |
4 |
Correct |
522 ms |
500 KB |
Correct |
5 |
Correct |
491 ms |
368 KB |
Correct |
6 |
Correct |
497 ms |
460 KB |
Correct |
7 |
Correct |
506 ms |
352 KB |
Correct |
8 |
Correct |
528 ms |
504 KB |
Correct |
9 |
Correct |
99 ms |
300 KB |
Correct |
10 |
Correct |
100 ms |
420 KB |
Correct |
11 |
Correct |
102 ms |
412 KB |
Correct |
12 |
Correct |
108 ms |
516 KB |
Correct |
13 |
Correct |
104 ms |
456 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
56 ms |
200 KB |
Correct |
2 |
Correct |
133 ms |
272 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
56 ms |
200 KB |
Correct |
2 |
Correct |
133 ms |
272 KB |
Correct |
3 |
Correct |
51 ms |
200 KB |
Correct |
4 |
Correct |
156 ms |
272 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
60 ms |
200 KB |
Correct |
2 |
Correct |
139 ms |
276 KB |
Correct |
3 |
Correct |
272 ms |
200 KB |
Correct |
4 |
Correct |
497 ms |
480 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
60 ms |
200 KB |
Correct |
2 |
Correct |
139 ms |
276 KB |
Correct |
3 |
Correct |
272 ms |
200 KB |
Correct |
4 |
Correct |
497 ms |
480 KB |
Correct |
5 |
Correct |
58 ms |
200 KB |
Correct |
6 |
Correct |
138 ms |
272 KB |
Correct |
7 |
Correct |
270 ms |
200 KB |
Correct |
8 |
Correct |
531 ms |
556 KB |
Correct |
9 |
Correct |
547 ms |
408 KB |
Correct |
10 |
Correct |
506 ms |
628 KB |
Correct |
11 |
Correct |
527 ms |
488 KB |
Correct |
12 |
Correct |
506 ms |
564 KB |
Correct |
13 |
Correct |
62 ms |
200 KB |
Correct |
14 |
Correct |
135 ms |
268 KB |
Correct |
15 |
Correct |
280 ms |
200 KB |
Correct |
16 |
Correct |
562 ms |
508 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
45 ms |
200 KB |
Correct |
2 |
Correct |
135 ms |
272 KB |
Correct |
3 |
Correct |
279 ms |
200 KB |
Correct |
4 |
Correct |
519 ms |
380 KB |
Correct |
5 |
Correct |
55 ms |
284 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
45 ms |
200 KB |
Correct |
2 |
Correct |
135 ms |
272 KB |
Correct |
3 |
Correct |
279 ms |
200 KB |
Correct |
4 |
Correct |
519 ms |
380 KB |
Correct |
5 |
Correct |
55 ms |
284 KB |
Correct |
6 |
Correct |
52 ms |
200 KB |
Correct |
7 |
Correct |
137 ms |
272 KB |
Correct |
8 |
Correct |
274 ms |
200 KB |
Correct |
9 |
Correct |
508 ms |
420 KB |
Correct |
10 |
Correct |
508 ms |
412 KB |
Correct |
11 |
Correct |
510 ms |
404 KB |
Correct |
12 |
Correct |
533 ms |
488 KB |
Correct |
13 |
Correct |
515 ms |
388 KB |
Correct |
14 |
Correct |
101 ms |
356 KB |
Correct |
15 |
Correct |
100 ms |
376 KB |
Correct |
16 |
Correct |
115 ms |
404 KB |
Correct |
17 |
Correct |
99 ms |
300 KB |
Correct |
18 |
Correct |
101 ms |
448 KB |
Correct |
19 |
Correct |
55 ms |
200 KB |
Correct |
20 |
Correct |
143 ms |
268 KB |
Correct |
21 |
Correct |
292 ms |
200 KB |
Correct |
22 |
Correct |
553 ms |
496 KB |
Correct |
23 |
Correct |
59 ms |
380 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
57 ms |
200 KB |
Correct |
2 |
Correct |
139 ms |
272 KB |
Correct |
3 |
Correct |
300 ms |
200 KB |
Correct |
4 |
Correct |
525 ms |
420 KB |
Correct |
5 |
Correct |
50 ms |
280 KB |
Correct |
6 |
Incorrect |
10 ms |
276 KB |
Not correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
57 ms |
200 KB |
Correct |
2 |
Correct |
139 ms |
272 KB |
Correct |
3 |
Correct |
300 ms |
200 KB |
Correct |
4 |
Correct |
525 ms |
420 KB |
Correct |
5 |
Correct |
50 ms |
280 KB |
Correct |
6 |
Incorrect |
10 ms |
276 KB |
Not correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
53 ms |
200 KB |
Correct |
2 |
Correct |
139 ms |
272 KB |
Correct |
3 |
Correct |
274 ms |
200 KB |
Correct |
4 |
Correct |
510 ms |
368 KB |
Correct |
5 |
Correct |
52 ms |
396 KB |
Correct |
6 |
Incorrect |
10 ms |
280 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
53 ms |
200 KB |
Correct |
2 |
Correct |
139 ms |
272 KB |
Correct |
3 |
Correct |
274 ms |
200 KB |
Correct |
4 |
Correct |
510 ms |
368 KB |
Correct |
5 |
Correct |
52 ms |
396 KB |
Correct |
6 |
Incorrect |
10 ms |
280 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |