#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(j, a, b) for (int j = a; j >= b; j--)
#include "chameleon.h"
#include <cstdio>
#include <cstdlib>
using namespace std;
vector <int> sub_vector(int b, int e, vector <int>& f){
vector <int> r(e-b);
rep(i,0,e-b){
r[i]=f[i+b];
}
return r;
}
int binary(int s, int ee, int e, vector <int>& curr){
int start=s, end = ee;
while(start!=end-1)
{
int middle = (start+end)/2;
//cout << "s&m&e: " << start << " " << middle << " " << end << endl;
vector <int> sub = sub_vector(middle,e, curr);
//cout << "binaryvec: ";
// rep(i,0,sub.size()){
// cout << sub[i] << " ";
// }
//cout << endl;
int see = Query(sub);
if(sub.size()==see)
end=middle;
else
start=middle;
}
return start;
}
void Solve(int N) {
int n=N*2;
vector <int> kkk(n+1);
rep(i,0,n+1)kkk[i]=i;
vector <int> curr;
rep(i,1,n+1){
curr.push_back(i);
if(Query(curr)==curr.size()){
continue;
}
// rep(i,0,curr.size()){
// cout << curr[i] << " ";
// }
//cout << endl;
int start=0, end = curr.size(), e = curr.size();
int remov = binary(0, curr.size(), curr.size(), curr);
//cout << i << " s " << curr[remov] << " " << remov << endl;
Answer(curr[remov], i);
curr.pop_back();
}
}
Compilation message
chameleon.cpp: In function 'int binary(int, int, int, std::vector<int>&)':
chameleon.cpp:40:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if(sub.size()==see)
~~~~~~~~~~^~~~~
chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:54:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if(Query(curr)==curr.size()){
~~~~~~~~~~~^~~~~~~~~~~~~
chameleon.cpp:61:13: warning: unused variable 'start' [-Wunused-variable]
int start=0, end = curr.size(), e = curr.size();
^~~~~
chameleon.cpp:61:22: warning: unused variable 'end' [-Wunused-variable]
int start=0, end = curr.size(), e = curr.size();
^~~
chameleon.cpp:61:41: warning: unused variable 'e' [-Wunused-variable]
int start=0, end = curr.size(), e = curr.size();
^
# |
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 |
21 ms |
384 KB |
Output is correct |
4 |
Correct |
21 ms |
392 KB |
Output is correct |
5 |
Correct |
24 ms |
384 KB |
Output is correct |
6 |
Correct |
21 ms |
424 KB |
Output is correct |
7 |
Correct |
21 ms |
384 KB |
Output is correct |
8 |
Correct |
22 ms |
384 KB |
Output is correct |
9 |
Correct |
22 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [5] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [5] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Incorrect |
5 ms |
308 KB |
Wrong Answer [5] |
3 |
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 |
21 ms |
384 KB |
Output is correct |
4 |
Correct |
21 ms |
392 KB |
Output is correct |
5 |
Correct |
24 ms |
384 KB |
Output is correct |
6 |
Correct |
21 ms |
424 KB |
Output is correct |
7 |
Correct |
21 ms |
384 KB |
Output is correct |
8 |
Correct |
22 ms |
384 KB |
Output is correct |
9 |
Correct |
22 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [5] |
12 |
Halted |
0 ms |
0 KB |
- |