제출 #713256

#제출 시각아이디문제언어결과실행 시간메모리
713256tht2005커다란 상품 (IOI17_prize)C++17
20 / 100
94 ms336 KiB
#include "prize.h" int find_best(int n) { int big = 0; std::vector<int> q_big(2, -1); for(int i = 0; i < n && i < 500; ++i) { std::vector<int> q = ask(i); if(q[0] == 0 && q[1] == 0) { return i; } if(q_big[0] + q_big[1] < q[0] + q[1]) { big = i; q_big = q; } } while(big + 1 < n) { int l = big + 1, r = n - 1; while(l <= r) { int mid = (l + r) >> 1; std::vector<int> q = ask(mid); if(q[0] + q[1] < q_big[0] + q_big[1] || q[1] < q_big[1]) { r = mid - 1; } else { big = mid; l = mid + 1; } } for(int i = big + 1; i < n; ++i) { std::vector<int> q = ask(i); if(q[0] == 0 && q[1] == 0) { return i; } if(q[0] + q[1] == q_big[0] + q_big[1]) { big = i; break; } } } }

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

prize.cpp: In function 'int find_best(int)':
prize.cpp:5:33: warning: control reaches end of non-void function [-Wreturn-type]
    5 |     std::vector<int> q_big(2, -1);
      |                                 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...