답안 #593320

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
593320 2022-07-10T21:15:47 Z stevancv Sure Bet (CEOI17_sure) C++14
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define sp ' '
#define en '\n'
#define smin(a, b) a = min(a, b)
#define smax(a, b) a = max(a, b)
using namespace std;
const int N = 5e5 + 2;
const int mod = 1e9 + 7;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n; cin >> n;
    vector<ld> a(n), b(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }
    sort(a.rbegin(), a.rend());
    sort(b.rbegin(), b.rend());
    for (int i = 1; i < n; i++) a[i] += a[i - 1];
    for (int i = 1; i < n; i++) b[i] += b[i - 1];
    for (ld i : a) cout << i << sp;
    cout << en;
    for (ld i : b) cout << i << sp;
    cout << en;
    ld ans = 0;
    for (int rep = 0; rep < 2; rep++) {
        int j = 0;
        for (int i = 0; i < n; i++) {
            while (j < n && b[j] < a[i]) j++;
            if (j < n) smax(ans, a[i] - i - j - 2);
        }
        swap(a, b);
    }
    cout << fixed << showpoint << setprecision(4) << ans << en;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -