Submission #130913

#TimeUsernameProblemLanguageResultExecution timeMemory
130913DiuvenSure Bet (CEOI17_sure)C++14
0 / 100
2 ms376 KiB
#include <bits/stdc++.h> using namespace std; typedef long long lint; typedef pair<int, int> pii; const int INF = 2e9; const int MOD = 1e9+7; const int MAX = 1e5+10; const lint LNF = 2e18; int n; double X[MAX], Y[MAX], ans; int main(){ ios::sync_with_stdio(0); cin.tie(0); cin>>n; for(int i=1; i<=n; i++) cin>>X[i]>>Y[i]; sort(X+1, X+n+1, greater<double>()); sort(Y+1, Y+n+1, greater<double>()); for(int i=0, j=1; i<=n; i++){ static double a = 0, b = 0; if(i!=0) a += X[i], a--, b--; while(j<=n && b<a){ b += Y[j++], b--, a--; } ans = max(ans, min(a,b)); } cout<<fixed; cout.precision(4); cout<<ans<<'\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...