#include<bits/stdc++.h>
using namespace std;
const long long maxn = 1e5+5;
long long N;
struct row {
vector<int> ar;
int ch;
friend void swap(row &a, row &b) {
a.ar.swap(b.ar);
swap(a.ch, b.ch);
}
};
row x,y;
void init(int n, vector<int> p) {
N = n;
x.ar = vector<int>(N);
y.ar = vector<int>(N);
for(int i = 0; i < N; i++) {
x.ar[i] = p[i]; // x to y
y.ar[p[i]] = i; // y to x
}
}
int fix(long long c) {
c += maxn * N;
return c % N;
}
void move_right(int K) {
x.ch += K;
}
void move_left(int K) {
x.ch -= K;
}
void swap_places() {
}
void move_around() {
swap(x,y);
}
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.ar[fix(D-y.ch)] + x.ch);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
62 ms |
6340 KB |
Output is correct |
2 |
Correct |
63 ms |
6340 KB |
Output is correct |
3 |
Correct |
66 ms |
6340 KB |
Output is correct |
4 |
Correct |
62 ms |
6340 KB |
Output is correct |
5 |
Correct |
41 ms |
4552 KB |
Output is correct |
6 |
Correct |
40 ms |
4548 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
5th lines differ - on the 1st token, expected: '411', found: '410' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
55 ms |
6340 KB |
Output is correct |
2 |
Correct |
56 ms |
6340 KB |
Output is correct |
3 |
Correct |
56 ms |
6340 KB |
Output is correct |
4 |
Correct |
35 ms |
4564 KB |
Output is correct |
5 |
Correct |
35 ms |
4708 KB |
Output is correct |
6 |
Correct |
34 ms |
4552 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
55 ms |
6340 KB |
Output is correct |
2 |
Correct |
56 ms |
6340 KB |
Output is correct |
3 |
Correct |
56 ms |
6340 KB |
Output is correct |
4 |
Correct |
35 ms |
4564 KB |
Output is correct |
5 |
Correct |
35 ms |
4708 KB |
Output is correct |
6 |
Correct |
34 ms |
4552 KB |
Output is correct |
7 |
Incorrect |
56 ms |
6340 KB |
3rd lines differ - on the 1st token, expected: '74726', found: '64493' |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
62 ms |
6340 KB |
Output is correct |
2 |
Correct |
63 ms |
6340 KB |
Output is correct |
3 |
Correct |
66 ms |
6340 KB |
Output is correct |
4 |
Correct |
62 ms |
6340 KB |
Output is correct |
5 |
Correct |
41 ms |
4552 KB |
Output is correct |
6 |
Correct |
40 ms |
4548 KB |
Output is correct |
7 |
Correct |
55 ms |
6340 KB |
Output is correct |
8 |
Correct |
56 ms |
6340 KB |
Output is correct |
9 |
Correct |
56 ms |
6340 KB |
Output is correct |
10 |
Correct |
35 ms |
4564 KB |
Output is correct |
11 |
Correct |
35 ms |
4708 KB |
Output is correct |
12 |
Correct |
34 ms |
4552 KB |
Output is correct |
13 |
Correct |
63 ms |
6248 KB |
Output is correct |
14 |
Correct |
60 ms |
6200 KB |
Output is correct |
15 |
Correct |
60 ms |
6320 KB |
Output is correct |
16 |
Correct |
39 ms |
4416 KB |
Output is correct |
17 |
Correct |
40 ms |
4580 KB |
Output is correct |
18 |
Correct |
40 ms |
4548 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
62 ms |
6340 KB |
Output is correct |
2 |
Correct |
63 ms |
6340 KB |
Output is correct |
3 |
Correct |
66 ms |
6340 KB |
Output is correct |
4 |
Correct |
62 ms |
6340 KB |
Output is correct |
5 |
Correct |
41 ms |
4552 KB |
Output is correct |
6 |
Correct |
40 ms |
4548 KB |
Output is correct |
7 |
Incorrect |
1 ms |
344 KB |
5th lines differ - on the 1st token, expected: '411', found: '410' |
8 |
Halted |
0 ms |
0 KB |
- |