//
// --- 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 <algorithm>
using namespace std;
void solve(int N, int V) {
vector<int> v = {0};
for (int p = 1; p < N; ++p) {
int lb = -1, ub = p;
while (ub - lb > 1) {
int mb = (lb + ub) / 2;
schedule(v[mb] + 1, p + 1);
int a = visit()[0];
if (a)
ub = mb;
else
lb = mb;
}
v.insert(v.begin() + ub, p);
}
reverse(v.begin(), v.end());
for (auto& x : v)
++x;
answer(v);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Correct |
2 |
Correct |
7 ms |
208 KB |
Correct |
3 |
Correct |
17 ms |
288 KB |
Correct |
4 |
Correct |
46 ms |
208 KB |
Correct |
5 |
Correct |
42 ms |
272 KB |
Correct |
6 |
Correct |
42 ms |
208 KB |
Correct |
7 |
Correct |
35 ms |
288 KB |
Correct |
8 |
Correct |
36 ms |
272 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Correct |
2 |
Correct |
6 ms |
208 KB |
Correct |
3 |
Correct |
8 ms |
288 KB |
Correct |
4 |
Correct |
31 ms |
272 KB |
Correct |
5 |
Correct |
28 ms |
284 KB |
Correct |
6 |
Correct |
34 ms |
208 KB |
Correct |
7 |
Correct |
34 ms |
208 KB |
Correct |
8 |
Correct |
50 ms |
288 KB |
Correct |
9 |
Runtime error |
17 ms |
288 KB |
Execution killed with signal 11 |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |