제출 #771564

#제출 시각아이디문제언어결과실행 시간메모리
771564_martynas커다란 상품 (IOI17_prize)C++11
20 / 100
75 ms336 KiB
#include "prize.h" #include <bits/stdc++.h> using namespace std; int find_best(int n) { int mx_sum = 0; for(int k = 0; k < 100; k++) { auto v = ask(rand() % n); mx_sum = max(mx_sum, v[0]+v[1]); } for(int i = 0; i < n; i++) { auto v = ask(i); int sum = v[0]+v[1]; if(sum == 0) { return i; } if(sum == mx_sum) { int l = i, r = n-1; while(l < r) { int m = (l+r+1)/2; auto v_p = ask(m); int sum_p = v_p[0]+v_p[1]; if(sum_p < mx_sum || v_p[0] > v[0]) { r = m-1; } else { l = m; } } i = l; } } return 0; } /* 5 2 2 2 1 2 8 3 3 2 3 3 2 1 3 sample: 8 3 2 3 1 3 3 2 3 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...