#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);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
428 KB |
Output is correct |
2 |
Correct |
2 ms |
400 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
1 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Wrong Answer[2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Wrong Answer[2] |
2 |
Halted |
0 ms |
0 KB |
- |