Submission #26159

#TimeUsernameProblemLanguageResultExecution timeMemory
26159khsoo01Memory 2 (JOI16_memory2)C++11
100 / 100
0 ms2024 KiB
#include "Memory2_lib.h" #include<bits/stdc++.h> using namespace std; vector<int> a[55]; void Solve(int _, int N) { int P = 0; for(int i=1;i<2*N;i++) { int T = Flip(P, i); a[T].push_back(i); if(a[T].size() >= 3) { int A = a[T][0], B = a[T][1], C = a[T][2]; a[T].clear(); a[T].push_back(P); int R1 = Flip(A, B), R2 = Flip(A, C); if(R1 == T) { int X = (R2==T?A:B); P = A+B-X; a[T].push_back(X); a[Flip(P, C)].push_back(C); } else { P = A; a[R1].push_back(B); a[R2].push_back(C); } } } for(int i=0;i<N;i++) { if(a[i].size() == 1) a[i].push_back(P); Answer(a[i][0], a[i][1], i); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...