Submission #865532

#TimeUsernameProblemLanguageResultExecution timeMemory
865532vjudge1Sure Bet (CEOI17_sure)C++17
100 / 100
58 ms2132 KiB
#include <bits/stdc++.h> #define file(s) freopen(s".in", "r", stdin); freopen(s".out", "w", stdout); #define adiyer(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define all(x) x.begin(), x.end() #define eb emplace_back #define elif else if #define uns unsigned #define emp empty() #define S second #define F first #define int long long using namespace std; typedef long long ll; typedef long double ldb; typedef vector < ll > vll; typedef vector < int > vi; typedef pair < ll, ll > pll; typedef pair < int, int > pi; typedef pair < ldb, ldb > pldb; typedef vector < pair < ll, ll > > vpll; typedef vector < pair < int, int > > vpi; const int N = 1e5 + 123; const int mod = 1e9 + 7; const int mxlg = 30; const int P = 31; const int K = 4; const ll inf = 1e9 + 10; ll n, j; double x, y, res; double a[N], b[N]; void output(){ 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), j = n; for(int i = n; i >= 1; i--){ res = max(res, min(x, y)); while(x <= y && j > 0){ x += a[j--], x--, y--; res = max(res, min(x, y)); } y += b[i], x--, y--; res = max(res, min(x, y)); } printf("%.4lf",(double)res); } const bool cases = 0; signed main(){ // file("disrupt"); adiyer(); int tt = 1; if(cases) cin >> tt; for(int i = 1; i <= tt; i++){ // cout << "Case " << i << ":\n"; output(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...