#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> dancer, pos;
int total = 0;
void move_right(int K) {
total += K;
}
void move_left(int K) {
total -= K;
}
void swap_places() {
for (int i = 0; i < n && total!=0; ++i) pos[i] = (((pos[i]+total)%n)+n)%n;
for (int i = 0; i < n && total!=0; ++i) dancer[pos[i]] = i;
total = 0;
for (int i = 0; i < n; i+=2) {
swap(pos[i], pos[i+1]);
swap(dancer[i], dancer[i+1]);
}
}
void move_around() {
for (int i = 0; i < n && total!=0; ++i) pos[i] = (((pos[i]+total)%n)+n)%n;
for (int i = 0; i < n && total!=0; ++i) dancer[pos[i]] = i;
total = 0;
swap(dancer, pos);
}
void init(int N, vector<int> P) {
n = N;
pos = dancer = vector<int>(N);
for (int i = 0; i < N; ++i) {
dancer[i] = P[i];
pos[P[i]] = i;
}
}
int get_position(int D) {
return (((pos[D]+total)%n)+n)%n;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
57 ms |
9264 KB |
Output is correct |
2 |
Correct |
59 ms |
9240 KB |
Output is correct |
3 |
Correct |
55 ms |
9292 KB |
Output is correct |
4 |
Correct |
67 ms |
9160 KB |
Output is correct |
5 |
Correct |
38 ms |
6600 KB |
Output is correct |
6 |
Correct |
36 ms |
6692 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
348 KB |
5th lines differ - on the 1st token, expected: '411', found: '56' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
53 ms |
8732 KB |
Output is correct |
2 |
Correct |
83 ms |
8656 KB |
Output is correct |
3 |
Correct |
85 ms |
8640 KB |
Output is correct |
4 |
Correct |
31 ms |
6056 KB |
Output is correct |
5 |
Correct |
38 ms |
6052 KB |
Output is correct |
6 |
Correct |
37 ms |
6176 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
53 ms |
8732 KB |
Output is correct |
2 |
Correct |
83 ms |
8656 KB |
Output is correct |
3 |
Correct |
85 ms |
8640 KB |
Output is correct |
4 |
Correct |
31 ms |
6056 KB |
Output is correct |
5 |
Correct |
38 ms |
6052 KB |
Output is correct |
6 |
Correct |
37 ms |
6176 KB |
Output is correct |
7 |
Execution timed out |
1006 ms |
6844 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
57 ms |
9264 KB |
Output is correct |
2 |
Correct |
59 ms |
9240 KB |
Output is correct |
3 |
Correct |
55 ms |
9292 KB |
Output is correct |
4 |
Correct |
67 ms |
9160 KB |
Output is correct |
5 |
Correct |
38 ms |
6600 KB |
Output is correct |
6 |
Correct |
36 ms |
6692 KB |
Output is correct |
7 |
Correct |
53 ms |
8732 KB |
Output is correct |
8 |
Correct |
83 ms |
8656 KB |
Output is correct |
9 |
Correct |
85 ms |
8640 KB |
Output is correct |
10 |
Correct |
31 ms |
6056 KB |
Output is correct |
11 |
Correct |
38 ms |
6052 KB |
Output is correct |
12 |
Correct |
37 ms |
6176 KB |
Output is correct |
13 |
Execution timed out |
1067 ms |
6996 KB |
Time limit exceeded |
14 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
57 ms |
9264 KB |
Output is correct |
2 |
Correct |
59 ms |
9240 KB |
Output is correct |
3 |
Correct |
55 ms |
9292 KB |
Output is correct |
4 |
Correct |
67 ms |
9160 KB |
Output is correct |
5 |
Correct |
38 ms |
6600 KB |
Output is correct |
6 |
Correct |
36 ms |
6692 KB |
Output is correct |
7 |
Incorrect |
2 ms |
348 KB |
5th lines differ - on the 1st token, expected: '411', found: '56' |
8 |
Halted |
0 ms |
0 KB |
- |