제출 #598413

#제출 시각아이디문제언어결과실행 시간메모리
598413MohamedFaresNebili커다란 상품 (IOI17_prize)C++14
20 / 100
91 ms1868 KiB
#include <bits/stdc++.h> #include "prize.h" /// #pragma GCC optimize ("Ofast") /// #pragma GCC target ("avx2") /// #pragma GCC optimize("unroll-loops") using namespace std; using ll = long long; using ld = long double; using ii = pair<ll, ll>; using vi = vector<int>; #define ff first #define ss second #define pb push_back #define all(x) (x).begin(), (x).end() #define lb lower_bound const int MOD = 1e9 + 7; int A[200005][2]; vector<int> query(int k) { if(A[k][0] != -1) return {A[k][0], A[k][1]}; return ask(k); } int find_best(int N) { memset(A, -1, sizeof A); int curr = 0; for(int l = 0; l < min(N, 474); l++) { vector<int> V = query(l); curr = max(curr, V[0] + V[1]); } int i = 0; while(i < N) { vector<int> V = query(i); if(V[0] + V[1] == 0) return i; if(V[0] + V[1] > curr) { i++; continue; } int l = i, r = N - 1, nxt = i; while(l <= r) { int md = (l + r + 1) / 2; vector<int> U = query(md); if(U[0] == V[0] && U[1] == V[1]) nxt = md, l = md + 1; else r = md - 1; } i = nxt + 1; } }

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

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