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;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAXN = 100;
int T, N, ans[MAXN+10];
vector<int> t[MAXN+10];
void Solve(int _T, int _N)
{
int i, j;
T=_T; N=_N;
srand(time(NULL));
memset(ans, -1, sizeof(ans));
int now;
while(1)
{
for(i=0; i<N; i++) t[i].clear();
now=rand()%(2*N);
while(ans[now]!=-1) now=rand()%(2*N);
for(i=0; i<2*N; i++)
{
if(i==now) continue;
int p=Flip(i, now);
t[p].push_back(i);
}
for(i=0; i<N; i++)
{
if(t[i].size()%2==0) for(auto it : t[i]) ans[it]=i;
else ans[now]=i;
}
int cnt=0, pos;
for(i=0; i<N*2; i++) if(ans[i]==-1) cnt++, pos=i;
if(cnt==1) { ans[pos]=N-1; break; }
//for(i=0; i<N*2; i++) printf("%d ", ans[i]); printf(" -> %d\n", now);
}
//for(i=0; i<N*2; i++) printf("%d ", ans[i]);
for(i=0; i<N; i++)
{
vector<int> V;
for(j=0; j<2*N; j++) if(ans[j]==i) V.push_back(j);
//printf("%d %d : %d\n", V[0], V[1], i);
Answer(V[0], V[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... |