| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 309747 | vipghn2003 | Sure Bet (CEOI17_sure) | C++14 | 0 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int n;
double a[N],b[N];
long long s[N];
bool check(long long lim)
{
long long cur=0;
for(int i=1;i<=n;i++)
{
cur+=a[i];
long long mx=(cur-lim)/10000-i;
if(mx<0) continue;
mx=min(mx,1ll*n);
if(s[mx]-1ll*i*10000>=lim) return true;
}
return false;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i]>>b[i];
a[i]*=10000;
b[i]*=10000;
}
sort(a+1,a+n+1);
sort(b+1,b+n+1);
reverse(a+1,a+n+1);
reverse(b+1,b+n+1);
for(int i=1;i<=n;i++) s[i]=max(s[i-1],s[i-1]+(int)b[i]-10000);
long long l=-1e18,r=1e18,res;
while(l<=r)
{
long long mid=(l+r)/2;
if(check(mid))
{
res=mid;
l=mid+1;
}
else r=mid-1;
}
cout<<fixed<<setprecision(4)<<1.0*res/10000;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
