제출 #103901

#제출 시각아이디문제언어결과실행 시간메모리
103901turbat커다란 상품 (IOI17_prize)C++14
0 / 100
62 ms384 KiB
#include "prize.h" #include <bits/stdc++.h> using namespace std; using vi = vector <int>; using pii = pair <int, int>; #define pb push_back #define mp make_pairdefine F first #define S second #define N 200005 int mx; int gg(int l, int r){ vi tmp, tmp1; if (l == r) { tmp = ask(l); if (tmp[0] + tmp[1] == 0) return l; return -1; } while (l <= r){ tmp = ask(l); if (tmp[0] + tmp[1] == 0) return l; if (tmp[0] + tmp[1] == mx) break; l++; } while(l <= r){ tmp1 = ask(r); if (tmp1[0] + tmp1[1] == 0) return r; if (tmp1[0] + tmp1[1] == mx) break; r--; } if (l > r) return -1; if (tmp1[0] == tmp[0]) return -1; if (l == r) return gg(l, r); int mid = (l + r) / 2; return max(gg(l, mid), gg(mid + 1, r)); } int find_best(int n) { for (int i = 0;i < n;i++){ vi tmp = ask(i); if (tmp[0] + tmp[1] == 0) return i; } }

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

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