이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "prize.h"
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
ll id,l,r,m,x,mx;
vector<ll>v[200009];
int find_best(int n)
{
while(id<n)
{
if(v[id].empty())
v[id]=ask(id);
if(v[id][0]+v[id][1]==0)
return id;
mx=max(mx,v[id][0]+v[id][1]);
if(mx>v[id][0]+v[id][1])
{
id++;
continue;
}
x=min(n-1,id+495);
if(v[x].empty())
v[x]=ask(x);
if(v[x][0]+v[x][1]==0)
return x;
mx=max(mx,v[x][0]+v[x][1]);
if(v[x]==v[id])
{
id=x+1;
continue;
}
l=id,r=x+1;
while(r-l>1)
{
m=(l+r)/2;
if(v[m].empty())
v[m]=ask(m);
if(v[m][0]+v[m][1]==0)
return m;
mx=max(mx,v[m][0]+v[m][1]);
if(v[m]==v[id])
l=m;
else
r=m;
}
id=l+1;
}
}
컴파일 시 표준 에러 (stderr) 메시지
prize.cpp: In function 'int find_best(int)':
prize.cpp:48:1: warning: control reaches end of non-void function [-Wreturn-type]
48 | }
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |