#include "chameleon.h"
#include <bits/stdc++.h>
using namespace std;
const int nx=1e3+5;
int vs[nx], v[nx][nx];
vector<int> d[nx];
void Solve(int N) {
for (int i=1; i<=2*N; i++) for (int j=1; j<i; j++) if (Query(vector<int> {i, j})==1) d[i].push_back(j), d[j].push_back(i);
for (int i=1; i<=2*N; i++)
{
if (vs[i]) continue;
if (d[i].size()==1)
{
Answer(i, d[i][0]);
vs[i]=vs[d[i][0]]=1;
continue;
}
bool f=0;
for (int j=0; j<2; j++)
{
vector<int> qrs;
qrs.push_back(i);
for (int k=0; k<3; k++) if (k!=j) qrs.push_back(d[i][k]);
if (Query(qrs)==1)
{
f=1;
v[i][d[i][j]]=v[d[i][j]][i]=1;
break;
}
}
if (!f) v[i][d[i][2]]=v[d[i][2]][i]=1;
}
for (int i=1; i<=2*N; i++)
{
if (vs[i]) continue;
for (int j=0; j<3; j++) if (!v[i][d[i][j]]&&!vs[i]) vs[i]=vs[d[i][j]]=1, Answer(i, d[i][j]);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Incorrect |
15 ms |
344 KB |
Wrong Answer [3] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
856 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Incorrect |
1 ms |
856 KB |
Wrong Answer [5] |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Incorrect |
15 ms |
344 KB |
Wrong Answer [3] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Incorrect |
15 ms |
344 KB |
Wrong Answer [3] |
4 |
Halted |
0 ms |
0 KB |
- |