Submission #839546

#TimeUsernameProblemLanguageResultExecution timeMemory
839546model_codeChoreography (IOI23_choreography)C++17
45 / 100
103 ms7512 KiB
// correct/sol_na_st5.cpp #include "choreography.h" #include <vector> #include <iostream> #include <cassert> std::vector<int> p, pos; int n,add,addi; bool inv=false; void init(int N, std::vector<int> P) { n=N; p=P; pos.resize(N); for(int i=0;i<N;++i) { pos[P[i]]=i; } } void move_right(int K) { add=(add+K+n)%n; } void move_left(int K) { move_right(n-K); } void swap_places() { assert(0); } void move_around() { inv=!inv; std::swap(add, addi); } int get_position(int D){ auto& x=(inv?p:pos); int poz=(D-addi+n)%n; return (x[poz]+add)%n; }
#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...