Submission #1027491

#TimeUsernameProblemLanguageResultExecution timeMemory
1027491vjudge1Sure Bet (CEOI17_sure)C++17
0 / 100
0 ms344 KiB
#include <bits/stdc++.h> #define int long long using namespace std; signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin>>n; double a[n+1],b[n+1]; for(int i=1;i<=n;i++){ cin>>a[i]>>b[i]; a[i]--; b[i]--; } sort(a+1,a+n+1,greater<double>()); sort(b+1,b+n+1,greater<double>()); int j=0; double sa=0,sb=0,res=0; for(int i=1;i<=n;i++){ sa+=a[i]; while(j<=n && (min(sa-j,sb-i)<min(sa-(j+1),(sb+b[j+1])-i))){ j++; sb+=b[j]; } res=max(res,min(sa-j,sb-i)); } cout<<fixed<<setprecision(10)<<res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...