#include "chameleon.h"
#include <bits/stdc++.h>
using namespace std;
vector<bool>vis(101, 0);
void ans(int a, int b){
if(vis[a]||vis[b])return;
Answer(a, b);
vis[a]=1, vis[b]=1;
return;
}
void Solve(int n) {
n*=2;
vector<vector<int>>adjs(n+1);
vector<int>sizs(n+1, 0);
for(int i=1; i<=n; i++){
for(int j=i+1; j<=n; j++){
if(Query({i, j})==1){
adjs[i].push_back(j);
adjs[j].push_back(i);
}
}
}
vector<vector<int>>B(n+1);
for(int i=1; i<=n; i++){
if(adjs[i].size()==1){
ans(i, adjs[i][0]);
}else{
for(int j=0; j<3; j++){
vector<int>A={i};
for(int a=0;a<=2; a++){
if(a!=j)A.push_back(adjs[i][a]);
}
if(Query(A)==1){
B[i].push_back(adjs[i][j]);
B[adjs[i][j]].push_back(i);
break;
}
}
}
}
for(int i=1; i<=n; i++){
if(vis[i])continue;
for(int a:adjs[i]){
if(a!=B[i][0]&&a!=B[i][1]){
ans(i, a);
}
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Incorrect |
26 ms |
384 KB |
Wrong Answer [3] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
7 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
288 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
6 |
Correct |
4 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
4 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
7 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
288 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
6 |
Correct |
4 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
4 ms |
384 KB |
Output is correct |
10 |
Correct |
6 ms |
384 KB |
Output is correct |
11 |
Correct |
6 ms |
384 KB |
Output is correct |
12 |
Correct |
6 ms |
384 KB |
Output is correct |
13 |
Correct |
6 ms |
384 KB |
Output is correct |
14 |
Correct |
6 ms |
384 KB |
Output is correct |
15 |
Correct |
6 ms |
384 KB |
Output is correct |
16 |
Correct |
6 ms |
384 KB |
Output is correct |
17 |
Correct |
6 ms |
384 KB |
Output is correct |
18 |
Correct |
6 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Incorrect |
33 ms |
384 KB |
Wrong Answer [3] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Incorrect |
26 ms |
384 KB |
Wrong Answer [3] |
4 |
Halted |
0 ms |
0 KB |
- |