Submission #585085

# Submission time Handle Problem Language Result Execution time Memory
585085 2022-06-28T09:55:14 Z tengiz05 Sure Bet (CEOI17_sure) C++17
0 / 100
0 ms 212 KB
#include <bits/stdc++.h>

using i64 = long long;
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n;
    cin >> n;
    
    vector<double> a(n), b(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }
    
    sort(a.begin(), a.end(), greater());
    sort(b.begin(), b.end(), greater());
    
    vector<double> pa(n + 1), pb(n + 1);
    
    for (int i = 0; i < n; i++) {
        pa[i + 1] = pa[i] + a[i];
        pb[i + 1] = pb[i] + b[i];
    }
    
    double ans = 0;
    
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n; j++) {
            ans = max(ans, min(pa[i], pb[j]) - i - j);
        }
    }
    
    cout << ans << "\n";
    
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -