Submission #843646

#TimeUsernameProblemLanguageResultExecution timeMemory
843646heavylightdecompChoreography (IOI23_choreography)C++17
7 / 100
1029 ms7140 KiB
#include<bits/stdc++.h>
using namespace std;
const long long maxn = 1e5+5;
long long x[maxn], y[maxn], s, t, N;
void init(int n, vector<int> p) {
    N = n;
    for(int i = 0; i < N; i++) {
        x[i] = p[i]; // x to y
        y[p[i]] = i; // y to x
    }
}
int fix(long long c) {
    c += maxn * N;
    return c % N;

}
void move_right(int K) {
    s += K;
}
void move_left(int K) {
    s -= K;
}
void swap_places() {
    
}
void move_around() {
    swap(x,y);
    swap(s,t);
}

int get_position(int D) {
    /*
    Careful! 
    x[i] represents p[i+s mod N]
    x[i-s mod N] represents p[i], the intended value
    same for y
    */

   return fix(y[fix(D-t)] + s);

}
#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...