Submission #65736

#TimeUsernameProblemLanguageResultExecution timeMemory
65736VahanSure Bet (CEOI17_sure)C++17
100 / 100
207 ms9496 KiB
#include<iostream> #include<algorithm> #include<cstdio> using namespace std; int n,t; double a[200000],b[200000],x,y,p=0; int main() { cin>>n; for(int i=1;i<=n;i++) cin>>a[i]>>b[i]; sort(a+1,a+n+1); sort(b+1,b+n+1); x=0;y=0;t=n; for(int i=n;i>=1;i--) { x+=a[i]; x-=1; y-=1; while(y<x && t>=1) { y+=b[t]; t--; y-=1; x-=1; } p=max(p,min(x,y)); } x=0;y=0;t=n; for(int i=n;i>=1;i--) { y+=b[i]; y-=1; x-=1; while(x<y && t>=1) { x+=a[t]; t--; x-=1; y-=1; } p=max(p,min(x,y)); } printf("%.4lf",(double)p); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...