이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "prize.h"
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> ii;
typedef long long ll;
typedef vector<ii> vii;
typedef vector<ll> vll;
typedef pair<long long, long long> pll;
typedef pair<char, int> ci;
typedef pair<string, int> si;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
#define pb push_back
#define fi first
#define se second
#define whole(v) v.begin(), v.end()
#define rwhole(v) v.rbegin(), v.rend()
#define inf INT_MAX/2
#define fro front
int find_best(int n) {
int ma = 0;
for(int i = 0; i < min(480, n); ++i){
vi x = ask(i);
if(x[0] + x[1] == 0){
return i;
}
ma = max(ma, x[0] + x[1]);
}
for(int i = 480; i < n; ++i){
vi x = ask(i);
if(x[0] + x[1] == ma){
int lo = i;
int hi = n;
while(hi - lo > 1){
int mid = lo + (hi - lo) / 2;
vi y = ask(mid);
if(y[0] == x[0] && y[1] == x[1]){
lo = mid;
}else{
hi = mid;
}
}
i = lo;
}else{
if(x[0] + x[1] == 0){
return i;
}
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
prize.cpp: In function 'int find_best(int)':
prize.cpp:54:1: warning: control reaches end of non-void function [-Wreturn-type]
54 | }
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |