#include "chameleon.h"
#include <bits/stdc++.h>
#include <vector>
using namespace std;
void Solve(int n)
{
vector <int> qry;
int h;
vector <int> candid[2*n];
int sim[2*n], flove[2*n];
for(int i = 0; i<2*n; i++)
{
flove[i] = -1;
for(int j = 0; j<i; j++)
{
qry.clear();
qry.push_back(i+1);
qry.push_back(j+1);
h = Query(qry);
if(h == 1)
{
candid[i].push_back(j);
candid[j].push_back(i);
}
}
}
int B;
for(int i = 0; i<2*n; i++)
{
if(candid[i].size() == 1)
{
sim[i] = candid[i][0];
continue;
}
flove[i] = candid[i][0];
qry = {i+1, candid[i][0]+1, candid[i][1]+1};
h = Query(qry);
if(h == 1)
flove[i] = candid[i][2];
qry = {i+1, candid[i][0]+1, candid[i][2]+1};
h = Query(qry);
if(h == 1)
flove[i] = candid[i][1];
}
for(int i = 0; i<2*n; i++)
{
if(candid[i].size() == 1)
continue;
for(int k = 0; k<3; k++)
{
B = candid[i][k];
if(flove[i] == B)
continue;
if(flove[B] == i)
continue;
sim[i] = B;
}
}
for(int i = 0; i<2*n; i++)
{
if(sim[i] > i)
Answer(i+1, sim[i]+1);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Incorrect |
24 ms |
328 KB |
Wrong Answer [3] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
200 KB |
Output is correct |
6 |
Correct |
0 ms |
200 KB |
Output is correct |
7 |
Correct |
1 ms |
200 KB |
Output is correct |
8 |
Correct |
0 ms |
200 KB |
Output is correct |
9 |
Correct |
0 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
200 KB |
Output is correct |
6 |
Correct |
0 ms |
200 KB |
Output is correct |
7 |
Correct |
1 ms |
200 KB |
Output is correct |
8 |
Correct |
0 ms |
200 KB |
Output is correct |
9 |
Correct |
0 ms |
200 KB |
Output is correct |
10 |
Correct |
1 ms |
200 KB |
Output is correct |
11 |
Correct |
1 ms |
200 KB |
Output is correct |
12 |
Correct |
2 ms |
200 KB |
Output is correct |
13 |
Correct |
2 ms |
200 KB |
Output is correct |
14 |
Correct |
2 ms |
200 KB |
Output is correct |
15 |
Correct |
2 ms |
200 KB |
Output is correct |
16 |
Correct |
2 ms |
200 KB |
Output is correct |
17 |
Correct |
2 ms |
200 KB |
Output is correct |
18 |
Correct |
2 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Incorrect |
30 ms |
200 KB |
Wrong Answer [3] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Incorrect |
24 ms |
328 KB |
Wrong Answer [3] |
4 |
Halted |
0 ms |
0 KB |
- |