답안 #1019666

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1019666 2024-07-11T06:43:35 Z overwatch9 Sure Bet (CEOI17_sure) C++17
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    int n;
    cin >> n;
    vector <pair <ll, ll>> nums(n);
    for (int i = 0; i < n; i++) {
        double a, b;
        cin >> a >> b;
        nums[i].first = (a * 10000);
        nums[i].second = (b * 10000);
    }
    vector <ll> a(n), b(n);
    for (int i = 0; i < n; i++) {
        a[i] = nums[i].first;
        b[i] = nums[i].second;
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    ll l = 0, r = 0;
    ll ans = 0;
    int pt1 = n-1, pt2 = n-1;
    ll cnt = 0;
    while (cnt < 2 * n) {
        if (l < r && pt1 >= 0) {
            l += a[pt1];
            pt1--;
        } else {
            r += b[pt2];
            pt2--;
        }
        cnt++;
        ans = max(ans, min(l, r) - cnt * 10000);
    }
    cout << fixed << setprecision(4) << (double)ans / 10000 << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -