Submission #842759

#TimeUsernameProblemLanguageResultExecution timeMemory
842759vjudge1Sure Bet (CEOI17_sure)C++17
0 / 100
0 ms2396 KiB
#include<bits/stdc++.h> using namespace std; #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #define fi first #define se second #define int long long #define pii pair<int,int> #define piii pair<int, pair<int, int>> #define v(int) vector<int> #define si size() #define foe(i,a,b) for(int i=a;i<=b;++i) #define fol(i,a,b) for(int i=a;i<b;++i) #define pb push_back #define Bit(mask,i) (1<<i)&mask #define offBit(mask,i) (1<<i)^mask #define onBit(mask,i) (1<<i)mask #define CNT(x) __builtin_popcountll(x) const int mod = 1e9+7; const int base = 2309; const int inf = 1e18; const int N = 1e6+10; const int LG = 20; // ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄▄ ▄ ▄▄▄▄ // █▄▄█ █ █ █ █ █▄▄█ █ █ ██ █ █ ▄▄ // █ █ █▄▄█ █▄▄█ █ █ █▄▄█ █ ██ █▄▄█ int n; double a[N], b[N]; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n; foe(i,1,n) { cin >> a[i] >> b[i]; } sort(a + 1, a + n + 1, greater<double>()); sort(b + 1, b + n + 1, greater<double>()); int l = 1, r = 1; double ans = 0.0000; double A = 0.0000, B = 0.0000; while(l < n || r < n) { if((A < B && l < n) || r == n) A += a[l++]; else B += b[r++]; -- A; -- B; ans = max(ans, min(A, B)); } cout << fixed << setprecision(4) << ans; cerr << "\n" << (double)clock() / CLOCKS_PER_SEC * 1000 << " ms"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...