#include<bits/stdc++.h>
using namespace std;
const long long maxn = 1e5+5;
long long 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(long long c) {
c += maxn * N;
return c % N;
}
void move_right(int K) {
s += K;
}
void move_left(int K) {
s -= K;
}
void swap_places() {
}
void move_around() {
swap(x,y);
swap(s,t);
}
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);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
61 ms |
7112 KB |
Output is correct |
2 |
Correct |
64 ms |
7060 KB |
Output is correct |
3 |
Correct |
61 ms |
7140 KB |
Output is correct |
4 |
Correct |
61 ms |
7108 KB |
Output is correct |
5 |
Correct |
40 ms |
5328 KB |
Output is correct |
6 |
Correct |
40 ms |
5324 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
17 ms |
1880 KB |
5th lines differ - on the 1st token, expected: '411', found: '410' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1029 ms |
5292 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1029 ms |
5292 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
61 ms |
7112 KB |
Output is correct |
2 |
Correct |
64 ms |
7060 KB |
Output is correct |
3 |
Correct |
61 ms |
7140 KB |
Output is correct |
4 |
Correct |
61 ms |
7108 KB |
Output is correct |
5 |
Correct |
40 ms |
5328 KB |
Output is correct |
6 |
Correct |
40 ms |
5324 KB |
Output is correct |
7 |
Execution timed out |
1029 ms |
5292 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
61 ms |
7112 KB |
Output is correct |
2 |
Correct |
64 ms |
7060 KB |
Output is correct |
3 |
Correct |
61 ms |
7140 KB |
Output is correct |
4 |
Correct |
61 ms |
7108 KB |
Output is correct |
5 |
Correct |
40 ms |
5328 KB |
Output is correct |
6 |
Correct |
40 ms |
5324 KB |
Output is correct |
7 |
Incorrect |
17 ms |
1880 KB |
5th lines differ - on the 1st token, expected: '411', found: '410' |
8 |
Halted |
0 ms |
0 KB |
- |