Submission #1252930

#TimeUsernameProblemLanguageResultExecution timeMemory
1252930kaiboySure Bet (CEOI17_sure)C++20
0 / 100
0 ms2104 KiB
#include <algorithm> #include <iostream> using namespace std; const int N = 100000; int aa[N], bb[N]; int main() { ios_base::sync_with_stdio(false), cin.tie(NULL); int n; cin >> n; for (int i = 0; i < n; i++) { double a, b; cin >> a >> b; aa[i] = a * 10000; bb[i] = b * 10000; } sort(aa, aa + n, greater<>()); sort(bb, bb + n, greater<>()); long long ans = 0, s = 0, t = 0; for (int i = 0, j = 0; i < n || j < n; ) { if (i < n && (j == n || s < t)) s += aa[i++]; else t += bb[j++]; ans = max(ans, min(s, t) - (i + j) * 10000); } printf("%d.%04d\n", (int) (ans / 10000), (int) (ans % 10000)); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...