Submission #1160304

#TimeUsernameProblemLanguageResultExecution timeMemory
1160304terrifierSure Bet (CEOI17_sure)C++20
0 / 100
0 ms320 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define niga ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0) #define yes cout<<"YES\n" #define no cout<<"NO\n" #define F first #define S second #define sz() size() #define pb push_back #define pf push_front #define all(a) a.begin(), a.end() #define bll(a) a.rbegin(), a.rend(); #define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout) /* a u t h o r (a b a); ──▒▒▒▒▒────▒▒▒▒▒────▒▒▒▒▒────▄████▄───── ─▒─▄▒─▄▒──▒─▄▒─▄▒──▒─▄▒─▄▒──███▄█▀─────── ─▒▒▒▒▒▒▒──▒▒▒▒▒▒▒──▒▒▒▒▒▒▒─▐████───────── ─▒▒▒▒▒▒▒──▒▒▒▒▒▒▒──▒▒▒▒▒▒▒──█████▄─────── ─▒─▒─▒─▒──▒─▒─▒─▒──▒─▒─▒─▒───▀████▀───── */ const int N = 2e5 + 9, mod = 1e9 + 7; int n; double a[N],b[N]; void solve(){ cin >> n; for (int i=1;i<=n;i++)cin >> a[i] >> b[i]; sort(a + 1,a + n + 1); reverse(a + 1, a + 1 + n); sort(b + 1,b + n + 1); reverse(b + 1, b + 1 + n); for (int i = 1; i <= n; i++){ a[i] += a[i - 1]; b[i] += b[i - 1]; } double res = 0; for (int i = 0; i <= n; i++){ for (int j = 0; j <= n; j++){ res = max(res, min(a[i] - i - j, b[j] - i - j)); } } cout << res; } signed main(){ niga; int aba = 1; // file("name"); // cin >> aba; while (aba --){ solve(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...