Submission #842623

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
8426232023-09-03 06:25:57WLZChoreography (IOI23_choreography)C++17
100 / 100
97 ms9300 KiB
#include "choreography.h"
#include <bits/stdc++.h>
using namespace std;
int n, cur;
vector< vector<int> > p, shift_p, add_p;
vector<int> add;
void init(int N, std::vector<int> P) {
n = N; cur = 0;
p = {P, vector<int>(n)};
add = {0, 0};
add_p = shift_p = {{0, 0}, {0, 0}};
for (int i = 0; i < n; i++) p[1][p[0][i]] = i;
return;
}
void move_right(int K) {
if (shift_p[cur][0] % 2 == 0) {
shift_p[cur][0] = (shift_p[cur][0] + K) % n;
shift_p[cur][1] = (shift_p[cur][1] + K) % n;
} else {
int a = shift_p[cur][0], b = shift_p[cur][1];
shift_p[cur][0] = (a + K) % n;
shift_p[cur][1] = (b + K) % n;
}
//shift[cur] = (shift[cur] + K) % n;
add[!cur] = (add[!cur] + K) % n;
return;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...