Submission #165764

#TimeUsernameProblemLanguageResultExecution timeMemory
165764jovan_bSure Bet (CEOI17_sure)C++17
100 / 100
131 ms5308 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; ld niz1[100005]; ld niz2[100005]; int main() { ios_base::sync_with_stdio(false); cout.precision(4); cout << fixed; int n; cin >> n; for(int i=0; i<n; i++){ cin >> niz1[i]; cin >> niz2[i]; niz1[i]--; niz2[i]--; } sort(niz1, niz1+n); sort(niz2, niz2+n); reverse(niz1, niz1+n); reverse(niz2, niz2+n); int j=0; ld res1=0; ld res2=0; ld maxres=0; for(int i=0; i<n; i++){ res1 += niz1[i]; while(j < n && min(res1-j, res2-i-1) < min(res1-j-1, res2+niz2[j]-i-1)){ res2 += niz2[j]; j++; } maxres = max(maxres, min(res1-j, res2-i-1)); } cout << maxres; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...