#include<bits/stdc++.h>
#include "chameleon.h"
using namespace std;
int a,b,c,d,e,i,j,ii,jj,zx,xc,bo[509],lef,rig,mid;
vector <int> v,vv;
void Solve(int NN) {
/* std::vector<int> p(3);
p[0] = 1;
p[1] = 2;
p[2] = 3;
variable_example = Query(p);
for (int i = 0; i < N; ++i) {
Answer(i * 2 + 1, i * 2 + 2);
}*/
a=NN;
for(i=0; i<=2*a+1; i++){
bo[i]=0;
}
for(int TA=1; TA<=a; TA++){
v.clear();
for(j=1; j<=2*a; j++){
if(bo[j]==0){
v.push_back(j);
}
}
lef=-1;rig=v.size();
while(1){
if(lef+1>=rig) break;
mid=(lef+rig)/2;
vv.clear();
for(i=0; i<=mid; i++){
vv.push_back(v[i]);
}
c=Query(vv);
if(c==vv.size()){
lef=mid;
}else{
rig=mid;
}
}
ii=rig;
lef=-1;rig=ii;
while(1){
if(lef+1>=rig) break;
mid=(lef+rig)/2;
vv.clear();
for(i=mid; i<=ii; i++){
vv.push_back(v[i]);
}
c=Query(vv);
//cout<<mid<<" "<<c<<"\n";
if(c==vv.size()){
rig=mid;
}else{
lef=mid;
}
}
jj=lef;
//cout<<jj<<" "<<ii<<" "<<v[jj]<<" "<<v[ii]<<"\n";
Answer(v[jj],v[ii]);
bo[v[ii]]=1;bo[v[jj]]=1;
}
}
Compilation message
chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:35:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
35 | if(c==vv.size()){
| ~^~~~~~~~~~~
chameleon.cpp:52:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
52 | if(c==vv.size()){
| ~^~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Incorrect |
1 ms |
208 KB |
Wrong Answer [1] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
304 KB |
Output is correct |
2 |
Incorrect |
1 ms |
208 KB |
Wrong Answer [6] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
304 KB |
Output is correct |
2 |
Incorrect |
1 ms |
208 KB |
Wrong Answer [6] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Incorrect |
0 ms |
208 KB |
Wrong Answer [6] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Incorrect |
1 ms |
208 KB |
Wrong Answer [1] |
4 |
Halted |
0 ms |
0 KB |
- |