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;
const int maxn = 1e3 + 5;
int bad[maxn];
vector<int> pos[maxn];
void Solve(int T, int N) {
int x = 0;
while(1) {
int ok = 0;
for(int y=x+1;y<2*N;y++) {
if(bad[y]) continue;
int tmp = Flip(x,y);
pos[tmp].push_back(y);
if(pos[tmp].size()==3) {
x = pos[tmp][0];
for(int i=0;i<N;i++) {
if(i==tmp) continue;
for(auto t : pos[i]) bad[t] = 1;
}
for(int i=0;i<N;i++) pos[i].clear();
ok = 1;
break;
}
}
if(!ok) break;
}
for(int i=0;i<2*N;i++) {
if(i!=x) pos[Flip(i,x)].push_back(i);
else pos[N-1].push_back(i);
}
for(int i=0;i<N;i++) Answer(pos[i][0],pos[i][1],i);
return ;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |