제출 #758441

#제출 시각아이디문제언어결과실행 시간메모리
758441Andrey커다란 상품 (IOI17_prize)C++14
20 / 100
111 ms336 KiB
#include "prize.h" #include<bits/stdc++.h> using namespace std; int find_best(int n) { int y = 0,l,r,m,x,big = 0,z; for(int i = 0; i*i < n; i++) { vector<int> a = ask(i); if(a[0] == 0 && a[1] == 0) { return i; } if(a[0]+a[1]) { big = a[0]+a[1]; y = i+1; } } while(y < n) { l = y; r = n-1; vector<int> a = ask(y); x = a[0]; z = a[1]; if(x+z != big) { if(a[0] == 0 && a[1] == 0) { return y; } y++; continue; } while(l < r) { m = (l+r+1)/2; a = ask(m); if(a[0] == x && a[1] == z) { l = m; } else { r = m-1; } } a = ask(l+1); if(a[0] == 0 && a[1] == 0) { return l+1; } y = l+2; } }

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

prize.cpp: In function 'int find_best(int)':
prize.cpp:46:1: warning: control reaches end of non-void function [-Wreturn-type]
   46 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...