This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |