#include "choreography.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> pos;
vector<int> perm;
vector<int>pom;
int shift;
int n,i;
void init(int N, std::vector<int> P) {
n=N;
pos.resize(n);
pom.resize(n);
for(int i=0;i<N;i++)pos[P[i]] = i;
perm = P;
return;
}
void move_right(int k) {
for(int i=0;i<n;i++)
pom[(i+k)%n]=perm[i];
perm = pom;
for(int i=0;i<n;i++)
pos[i] = (pos[i]+k)%n;
return;
}
void move_left(int k) {
for(int i=0;i<n;i++)
pom[(i-k+n)%n]=perm[i];
perm = pom;
for(int i=0;i<n;i++)
pos[i] = (pos[i]-k+n)%n;
return;
}
void swap_places() {
for(i=0;i<n;i++)
if(i%2==0)swap(perm[i], perm[i+1]);
for(i=0;i<n;i++)
pos[i]^=1;
return;
}
void move_around() {
for(i=0;i<n;i++)
pom[perm[perm[i]]] = perm[i];
perm = pom;
for(i=0;i<n;i++)
pos[perm[i]]=i;
return;
}
int get_position(int D){
// for(i=0;i<n;i++)
// printf("%d ", perm[i]);
// exit(0);
return pos[D];
// return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1072 ms |
7192 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Output is correct |
2 |
Correct |
3 ms |
444 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
4 ms |
1192 KB |
Output is correct |
5 |
Correct |
3 ms |
604 KB |
Output is correct |
6 |
Correct |
4 ms |
1116 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1038 ms |
6996 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1038 ms |
6996 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1072 ms |
7192 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1072 ms |
7192 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |