Submission #380034

#TimeUsernameProblemLanguageResultExecution timeMemory
380034nextgenxingSure Bet (CEOI17_sure)C++14
60 / 100
2088 ms4972 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define f first #define s second #define all(x) begin(x), end(x) #define rall(x) (x).rbegin(), (x).rend() #define sz(x) (int)(x).size() #define FOR(i, a, b) for(int i = (a); i < (b); i++) #define F0R(i, x) FOR(i, 0, x) #define FORd(i, a, b) for(int i = (b)-1; i >= (a); i--) #define F0Rd(i, x) FORd(i, 0, x) #define ckif(a, b, c) ((c) ? (a) : (b)) const int MAX_N = 100001; const ll MOD = 1000000007; const ll INF = 1e18; int n; double a[MAX_N], b[MAX_N], pa[MAX_N], pb[MAX_N]; int main(int argc, const char * argv[]){ ios_base::sync_with_stdio(0), cin.tie(0); cin >> n; F0R(i, n) cin >> a[i] >> b[i]; sort(a, a+n), sort(b, b+n); reverse(a, a+n), reverse(b, b+n); pa[0] = a[0], pb[0] = b[0]; FOR(i, 1, n) pa[i] = pa[i-1]+a[i], pb[i] = pb[i-1]+b[i]; double ans = 0; F0R(i, n) F0R(j, n){ ans = max(ans, min(pa[i]-double(i+j+2), pb[j]-double(i+j+2))); } cout << fixed << setprecision(4) << ans << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...