#include "choreography.h"
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> v2i;
typedef pair<int, int> pi;
typedef vector<pi> vp;
#define pb push_back
#define mp make_pair
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
vi p;
int n;
vp moves;
vi counts(4, 0);
vi pos;
int totalshift;
void init(int N, vi P) {
p = P;
n = N;
pos.resize(N);
int i = 0;
for (auto d : P) {
pos[d] = i++;
}
}
void move_right(int K) {
moves.pb({ 1, K });
counts[0]++;
totalshift += K;
}
void move_left(int K) {
moves.pb({ 2, K });
counts[1]++;
totalshift -= K;
}
void swap_places() {
moves.pb({ 3, 0 });
counts[2]++;
}
void move_around() {
moves.pb({ 4, 0 });
counts[3]++;
}
int get_position(int D){
int res = ((pos[D] + totalshift) % n + n) % n;
return res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
67 ms |
7372 KB |
Output is correct |
2 |
Correct |
68 ms |
10320 KB |
Output is correct |
3 |
Correct |
68 ms |
9708 KB |
Output is correct |
4 |
Correct |
69 ms |
10136 KB |
Output is correct |
5 |
Correct |
43 ms |
7440 KB |
Output is correct |
6 |
Correct |
44 ms |
7376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
5th lines differ - on the 1st token, expected: '411', found: '410' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
60 ms |
6824 KB |
16th lines differ - on the 1st token, expected: '54117', found: '49341' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
60 ms |
6824 KB |
16th lines differ - on the 1st token, expected: '54117', found: '49341' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
67 ms |
7372 KB |
Output is correct |
2 |
Correct |
68 ms |
10320 KB |
Output is correct |
3 |
Correct |
68 ms |
9708 KB |
Output is correct |
4 |
Correct |
69 ms |
10136 KB |
Output is correct |
5 |
Correct |
43 ms |
7440 KB |
Output is correct |
6 |
Correct |
44 ms |
7376 KB |
Output is correct |
7 |
Incorrect |
60 ms |
6824 KB |
16th lines differ - on the 1st token, expected: '54117', found: '49341' |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
67 ms |
7372 KB |
Output is correct |
2 |
Correct |
68 ms |
10320 KB |
Output is correct |
3 |
Correct |
68 ms |
9708 KB |
Output is correct |
4 |
Correct |
69 ms |
10136 KB |
Output is correct |
5 |
Correct |
43 ms |
7440 KB |
Output is correct |
6 |
Correct |
44 ms |
7376 KB |
Output is correct |
7 |
Incorrect |
1 ms |
348 KB |
5th lines differ - on the 1st token, expected: '411', found: '410' |
8 |
Halted |
0 ms |
0 KB |
- |