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;
using LL = long long;
void Solve(int T, int N){
N *= 2;
int ans[104];
int pos[3] = {0, 1, 2};
for(int i = 3; i < N; ++i){
int val[3] = {Flip(pos[0], i), Flip(pos[1], i), Flip(pos[2], i)};
if(val[0] == val[1] && val[1] == val[2]){
ans[i] = val[0];
continue;
}
if(val[0] <= val[1] && val[0] <= val[2]){
ans[pos[0]] = val[0];
pos[0] = i;
}
else if(val[1] <= val[0] && val[1] <= val[2]){
ans[pos[1]] = val[1];
pos[1] = i;
}
else{
ans[pos[2]] = val[2];
pos[2] = i;
}
}
if(N == 2){
ans[0] = ans[1] = 0;
return;
}
int val[3] = {Flip(pos[0], pos[1]), Flip(pos[1], pos[2]), Flip(pos[2], pos[0])};
if(val[0] == val[1]){
ans[pos[1]] = val[0];
ans[pos[0]] = ans[pos[2]] = val[2];
}
else if(val[1] == val[2]){
ans[pos[2]] = val[1];
ans[pos[0]] = ans[pos[1]] = val[0];
}
else{
ans[pos[0]] = val[0];
ans[pos[1]] = ans[pos[2]] = val[1];
}
for(int i = 0; i < N; ++i){
if(ans[i] == -1){
continue;
}
for(int j = i + 1; j < N; ++j){
if(ans[i] == ans[j]){
Answer(i, j, ans[i]);
ans[j] = -1;
break;
}
}
}
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... |