#include <bits/stdc++.h>
#include "chameleon.h"
using namespace std;
int n;
vector<int> link[1002];
int opp[1002];
vector<int> range(int l, int r){
vector<int> ret;
for(int i=l; i<=r; i++) ret.push_back(i);
return ret;
}
int group[1002];
vector<int> groupVec[3];
void dfs(int x, int g){
group[x] = g;
groupVec[g].push_back(x);
for(auto &y: link[x]){
if(!group[y]) dfs(y, 3-g);
}
}
void Solve(int N){
n = N;
for(int i=1; i<=2*n; i++){
for(int j=1; j<=2*n; j++){
if(i==j) continue;
if(Query({i, j}) == 1) link[i].push_back(j);
}
}
for(int i=1; i<=2*n; i++){
if(!group[i]){
dfs(i, 1);
}
}
for(int i=1; i<=2*n; i++){
if((int)link[i].size() == 1){
opp[i] = link[i][0];
opp[link[i][0]] = i;
continue;
}
int g1 = link[i][0], g2 = link[i][1], g3 = link[i][2];
opp[i] += g1 + g2 + g3;
int q1 = Query({i, g2, g3}), q2 = Query({i, g1, g3});
if(q1 == 1) opp[i] -= g1, opp[g1] -= i;
else if(q2 == 1) opp[i] -= g2, opp[g2] -= i;
else opp[i] -= g3, opp[g3] -= i;
}
for(int i=1; i<=2*n; i++){
if(i < opp[i]) Answer(i, opp[i]);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Incorrect |
17 ms |
384 KB |
Wrong Answer [3] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Incorrect |
0 ms |
384 KB |
Wrong Answer [7] |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Incorrect |
0 ms |
384 KB |
Wrong Answer [7] |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Incorrect |
17 ms |
384 KB |
Wrong Answer [3] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Incorrect |
17 ms |
384 KB |
Wrong Answer [3] |
4 |
Halted |
0 ms |
0 KB |
- |