# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
314099 | lukameladze | 커다란 상품 (IOI17_prize) | C++14 | 112 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "prize.h"
# include <bits/stdc++.h>
std::vector<int> res;
int le,l,x1,x2,mx,mid,ri,ans;
int find_best(int n)
{
for (int i=0; i<=500; i++)
{
res=ask(i);
if (res[0]+res[1]==0)
{
return i;
}
if (res[0]+res[1]>=mx)
{
mx=res[0]+res[1];
l=i;
x1=res[0];
x2=res[1];
}
}
while (true)
{
le=l+1;
ri=n-1;
while (le<=ri)
{
mid=(le+ri)/2;
res=ask(mid);
if (res[0]+res[1]==0)
{
return mid;
}
if (res[0]+res[1]!=mx)
{
ans=mid;
}
if (res[0]==x1 && res[0]+res[1]==mx)
{
le=mid+1;
}
else
{
ri=mid-1;
}
}
for (int i=ans+1; i<n; i++)
{
res=ask(i);
if (res[0]+res[1]==0)
{
return i;
}
if (res[0]+res[1]==mx)
{
l=i;
x1=res[0];
break;
}
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |