#include <bits/stdc++.h>
#include "swaps.h"
template <class T> using Vec = std::vector<T>;
void solve(int N, int V) {
if (V == 5000) {
Vec<char> done(N);
Vec<int> ans;
while (true) {
Vec<int> remain;
for (int i = 0; i < N; ++i) {
if (!done[i]) {
remain.push_back(i);
}
}
if (remain.empty()) {
break;
}
while (remain.size() > 1) {
Vec<int> next;
Vec<std::array<int, 2>> ask;
for (int i = 0; i + 1 < (int) remain.size(); i += 2) {
schedule(remain[i] + 1, remain[i + 1] + 1);
ask.push_back({remain[i + 1], remain[i]});
}
const auto ret = visit();
for (int i = 0; i < (int) ret.size(); ++i) {
next.push_back(ask[i][ret[i]]);
}
if (remain.size() % 2 == 1) {
next.push_back(remain.back());
}
remain = std::move(next);
}
done[remain[0]] = true;
ans.push_back(remain[0] + 1);
}
answer(ans);
} else {
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
284 KB |
Correct |
2 |
Correct |
6 ms |
292 KB |
Correct |
3 |
Correct |
35 ms |
296 KB |
Correct |
4 |
Correct |
164 ms |
300 KB |
Correct |
5 |
Correct |
79 ms |
312 KB |
Correct |
6 |
Correct |
81 ms |
308 KB |
Correct |
7 |
Correct |
137 ms |
300 KB |
Correct |
8 |
Correct |
116 ms |
316 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
200 KB |
Correct |
2 |
Correct |
14 ms |
296 KB |
Correct |
3 |
Correct |
26 ms |
296 KB |
Correct |
4 |
Correct |
104 ms |
316 KB |
Correct |
5 |
Correct |
108 ms |
308 KB |
Correct |
6 |
Correct |
121 ms |
308 KB |
Correct |
7 |
Correct |
101 ms |
312 KB |
Correct |
8 |
Correct |
107 ms |
304 KB |
Correct |
9 |
Incorrect |
1 ms |
200 KB |
Not correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
200 KB |
Correct |
2 |
Correct |
13 ms |
200 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
200 KB |
Correct |
2 |
Correct |
13 ms |
200 KB |
Correct |
3 |
Correct |
2 ms |
200 KB |
Correct |
4 |
Correct |
15 ms |
200 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Correct |
2 |
Correct |
7 ms |
200 KB |
Correct |
3 |
Correct |
41 ms |
284 KB |
Correct |
4 |
Correct |
126 ms |
308 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Correct |
2 |
Correct |
7 ms |
200 KB |
Correct |
3 |
Correct |
41 ms |
284 KB |
Correct |
4 |
Correct |
126 ms |
308 KB |
Correct |
5 |
Correct |
2 ms |
200 KB |
Correct |
6 |
Correct |
17 ms |
292 KB |
Correct |
7 |
Correct |
45 ms |
284 KB |
Correct |
8 |
Correct |
104 ms |
336 KB |
Correct |
9 |
Correct |
81 ms |
316 KB |
Correct |
10 |
Correct |
112 ms |
308 KB |
Correct |
11 |
Correct |
110 ms |
308 KB |
Correct |
12 |
Correct |
90 ms |
312 KB |
Correct |
13 |
Correct |
1 ms |
200 KB |
Correct |
14 |
Correct |
8 ms |
200 KB |
Correct |
15 |
Correct |
22 ms |
300 KB |
Correct |
16 |
Correct |
93 ms |
304 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Correct |
2 |
Correct |
6 ms |
284 KB |
Correct |
3 |
Correct |
41 ms |
296 KB |
Correct |
4 |
Correct |
112 ms |
316 KB |
Correct |
5 |
Incorrect |
1 ms |
200 KB |
Not correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Correct |
2 |
Correct |
6 ms |
284 KB |
Correct |
3 |
Correct |
41 ms |
296 KB |
Correct |
4 |
Correct |
112 ms |
316 KB |
Correct |
5 |
Incorrect |
1 ms |
200 KB |
Not correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
200 KB |
Correct |
2 |
Correct |
12 ms |
292 KB |
Correct |
3 |
Correct |
26 ms |
296 KB |
Correct |
4 |
Correct |
115 ms |
312 KB |
Correct |
5 |
Incorrect |
1 ms |
200 KB |
Not correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
200 KB |
Correct |
2 |
Correct |
12 ms |
292 KB |
Correct |
3 |
Correct |
26 ms |
296 KB |
Correct |
4 |
Correct |
115 ms |
312 KB |
Correct |
5 |
Incorrect |
1 ms |
200 KB |
Not correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
200 KB |
Correct |
2 |
Correct |
12 ms |
284 KB |
Correct |
3 |
Correct |
54 ms |
300 KB |
Correct |
4 |
Correct |
104 ms |
284 KB |
Correct |
5 |
Incorrect |
1 ms |
200 KB |
Not correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
200 KB |
Correct |
2 |
Correct |
12 ms |
284 KB |
Correct |
3 |
Correct |
54 ms |
300 KB |
Correct |
4 |
Correct |
104 ms |
284 KB |
Correct |
5 |
Incorrect |
1 ms |
200 KB |
Not correct |
6 |
Halted |
0 ms |
0 KB |
- |