This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5+5;
int N;
vector<int> P;
void init(int n, vector<int> p) {
N = n;
P = p;
}
void move_right(int K) {
vector<int> p_new = P;
for(int i = 0; i < N; i++) {
p_new[(i+K)%N] = P[i];
}
P = p_new;
}
void move_left(int K) {
vector<int> p_new = P;
for(int i = 0; i < N; i++) {
p_new[i] = P[(i+K)%N];
}
P = p_new;
}
void swap_places() {
for(int i = 0; i < N/2; i++) {
swap(P[i], P[i+1]);
}
}
void move_around() {
vector<int> p_new = P;
for(int i = 0; i < N; i++) {
p_new[P[i]] = i;
}
P = p_new;
}
int get_position(int D) {
int res = -1;
for(int i = 0; i < N; i++) {
if(P[i] == D) {
res = i;
break;
}
}
return res;
}
# | 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... |