제출 #1149508

#제출 시각아이디문제언어결과실행 시간메모리
1149508dostsSure Bet (CEOI17_sure)C++20
60 / 100
2095 ms1864 KiB
#include <bits/stdc++.h> #pragma GCC target("avx2") #pragma GCC optimize("O3,unroll-loops") using namespace std; #define int long long #define pii pair<int,int> #define ff first #define ss second #define sp << " " << #define all(cont) cont.begin(),cont.end() #define vi vector<int> const int inf = 1e17,N = 3e5+1,MOD = 998244353,BL = 1000; void solve() { int n; cin >> n; vector<double> odds(n),odds2(n); for (int i = 0;i<n;i++) cin >> odds[i] >> odds2[i]; sort(all(odds),greater<double>()),sort(all(odds2),greater<double>()); double ans = 0; double s = 0,s2 = 0; for (int i=0;i<=n;i++) { if (i) s+=odds[i-1]; s2 = 0; for (int j = 0;j<=n;j++) { if (j) s2+=odds2[j-1]; ans = max(ans,min(s-j,s2-j)-i); } } cout << fixed; cout << setprecision(4) << ans << '\n'; } int32_t main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #ifdef Dodi freopen("in.txt","r",stdin); freopen("out.txt","w",stdout); #endif int t = 1; //cin >> t; while (t --> 0) solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...