이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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();
}
}
컴파일 시 표준 에러 (stderr) 메시지
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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |