| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 67159 | Megumi_Tadokoro | Sure Bet (CEOI17_sure) | C++14 | 125 ms | 7416 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int n, L = 0, R = 0;
double a[100010], b[100010], A = 0, B = 0, ans = 0;
int main() {
iostream::sync_with_stdio(0); cin.tie(0);
cin >> n;
for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
sort(a, a + n, greater<double> ());
sort(b, b + n, greater<double> ());
while(L < n && R < n) {
if(A < B) {
A += a[L] - 1.0, B -= 1.0;
ans = max(ans, min(A, B)), L++;
}
else {
B += b[R] - 1.0, A -= 1.0;
ans = max(ans, min(A, B)), R++;
}
}
while(L < n) {
A += a[L] - 1.0, B -= 1.0;
ans = max(ans, min(A, B)), L++;
}
while(R < n) {
B += b[R] - 1.0, A -= 1.0;
ans = max(ans, min(A, B)), R++;
}
cout << fixed << setprecision(4) << ans;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
