#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5+5;
int x[maxn], y[maxn], s, t, N;
void init(int n, vector<int> p) {
N = n;
for(int i = 0; i < N; i++) {
x[i] = p[i]; // x to y
y[p[i]] = i; // y to x
}
}
int fix(int c) {
while(c >= N) { c -= N; }
while(c < 0) { c += N; }
return c;
//This code is theoretically slow, but it seems to be optimized by compiler ^^
}
void move_right(int K) {
s += K;
}
void move_left(int K) {
s -= K;
}
void swap_places() {
swap(x,y);
swap(s,t);
}
void move_around() {
}
int get_position(int D) {
/*
Careful!
x[i] represents p[i+s mod N]
x[i-s mod N] represents p[i], the intended value
same for y
*/
return fix(y[fix(D-t)] + s);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
67 ms |
9072 KB |
Output is correct |
2 |
Correct |
73 ms |
9288 KB |
Output is correct |
3 |
Correct |
71 ms |
9096 KB |
Output is correct |
4 |
Correct |
67 ms |
9160 KB |
Output is correct |
5 |
Correct |
48 ms |
6600 KB |
Output is correct |
6 |
Correct |
49 ms |
6608 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
18 ms |
1112 KB |
5th lines differ - on the 1st token, expected: '411', found: '306' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
58 ms |
8668 KB |
16th lines differ - on the 1st token, expected: '54117', found: '49341' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
58 ms |
8668 KB |
16th lines differ - on the 1st token, expected: '54117', found: '49341' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
67 ms |
9072 KB |
Output is correct |
2 |
Correct |
73 ms |
9288 KB |
Output is correct |
3 |
Correct |
71 ms |
9096 KB |
Output is correct |
4 |
Correct |
67 ms |
9160 KB |
Output is correct |
5 |
Correct |
48 ms |
6600 KB |
Output is correct |
6 |
Correct |
49 ms |
6608 KB |
Output is correct |
7 |
Incorrect |
58 ms |
8668 KB |
16th lines differ - on the 1st token, expected: '54117', found: '49341' |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
67 ms |
9072 KB |
Output is correct |
2 |
Correct |
73 ms |
9288 KB |
Output is correct |
3 |
Correct |
71 ms |
9096 KB |
Output is correct |
4 |
Correct |
67 ms |
9160 KB |
Output is correct |
5 |
Correct |
48 ms |
6600 KB |
Output is correct |
6 |
Correct |
49 ms |
6608 KB |
Output is correct |
7 |
Incorrect |
18 ms |
1112 KB |
5th lines differ - on the 1st token, expected: '411', found: '306' |
8 |
Halted |
0 ms |
0 KB |
- |