Submission #681399

#TimeUsernameProblemLanguageResultExecution timeMemory
681399vjudge1Sure Bet (CEOI17_sure)C++14
0 / 100
0 ms212 KiB
#include <bits/stdc++.h> using namespace std; #define F first #define S second #define pb push_back #define all(a) a.begin(), a.end() typedef long long ll; typedef pair<int, int> ii; typedef pair<double, double> pdd; void print() {cerr << '\n';} template <typename T1, typename... T2> void print(const T1 &a, const T2 &...b) { cerr << a << ' ', print(b...); } const int N = 1e5; const int mod = 1e9 + 7; double a[N], b[N]; double res = -1e18; int n; void solve() { cin >> n; for(int i = 1; i <= n; i++) cin >> a[i] >> b[i]; sort(a + 1, a + 1 + n, greater<double>()); sort(b + 1, b + 1 + n, greater<double>()); for(int i = 1; i <= n; i++) { a[i] += a[i - 1]; b[i] += b[i - 1]; } for(int num = 1; num <= n; num++) for(int i = 0; i <= num; i++) res = max(res, min(a[i] - num, b[num - i] - num)); cout << setprecision(4) << fixed << res; } signed main() { cin.tie(0)->sync_with_stdio(0); int t = 1; // cin >> t; while(t--) solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...