제출 #117461

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
1174612019-06-16 01:37:35tjd229커다란 상품 (IOI17_prize)C++14
98.89 / 100
56 ms5272 KiB
#include "prize.h"
#include <vector>
#define pii pair<int,int>
using namespace std;
const int seg = 511;//473-1
int pre;
int nc;//1+2+3+4
int call;
vector<int> v[200000];
void my_ask(int i) {
if (v[i].empty()) v[i] = ask(i),++call;
}
int search(int l,int r,int tgt) {
int t = -1;
while (l <= r) {
int m = (l + r) >> 1;
my_ask(m);
if (v[m][0] + v[m][1] != nc) {
t = m, r = m - 1;
if (tgt == 1) return t;
}
else if (v[m][0] == pre) l = m + 1,tgt=v[m][0]-pre;
else r = m - 1;
}
return t;
}
int find_best(int n) {
if (n <= 5000) {
for (int i = 0; i < n; ++i) {
my_ask(i);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

컴파일 시 표준 에러 (stderr) 메시지

prize.cpp: In function 'int find_best(int)':
prize.cpp:56:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (i = 0; i < g.size();) {
              ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...