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-subtask2.cpp
#include "choreography.h"
#include <vector>
#include <iostream>
int n;
std::vector<int> p;
void init(int N, std::vector<int> P){
n = N;
p = P;
}
void move_right(int K){
std::vector<int> p2(n);
for(int i = 0; i < n; i++){
p2[i] = p[((i - K) % n + n) % n];
}
std::swap(p, p2);
}
void move_left(int K){
move_right(-K);
}
void swap_places(){
for(int i = 0; i < n; i += 2){
std::swap(p[i], p[i+1]);
}
}
void move_around(){
std::vector<int> inv(n);
for(int i = 0; i < n; i++) {
inv[p[i]] = i;
}
std::swap(inv, p);
}
int get_position(int D){
int j = 0;
while(p[j] != D) ++j;
return j;
}
# | 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... |