This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// correct/solution-subtask5.cpp
#include "choreography.h"
#include <vector>
int x = 0, j = 0, n;
bool s = false;
std::vector<int> p, inv;
void init(int N, std::vector<int> P){
n = N;
p = P;
inv.resize(N);
for(int i = 0; i < N; i++){
inv[P[i]] = i;
}
}
void move_right(int K){
x += K;
if(x >= n) x -= n;
}
void move_left(int K){
move_right(n - K);
}
void swap_places() {}
void move_around(){
s = !s;
std::swap(x, j);
}
int get_position(int D){
int i = D - j;
if(i < 0) i += n;
int ans = s ? p[i] + x : inv[i] + x;
return ans < n ? ans : ans - n;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |