Submission #321833

# Submission time Handle Problem Language Result Execution time Memory
321833 2020-11-13T12:30:21 Z Karen124 Sure Bet (CEOI17_sure) C++14
0 / 100
1 ms 492 KB
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
     
using namespace std;
     
#define ll long long int 
#define F first
#define S second
#define pb push_back
 
const ll N = 1e5 + 10;
const ll LOG = 20;
const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 10;
int n;
long double a[N], b[N], ans, psa[N], psb[N];
int main() {
    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> a[i] >> b[i];
    }
    sort(a, a + n); sort(b, b + n);
    for (int i = n - 1; i >= 0; i--){
        psa[i] = psa[i + 1] + a[i];
        psb[i] = psb[i + 1] + b[i];
    }
    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= n; j++){
            ans = max(ans, min(psa[max(0, n - i)], psb[max(0, n - j)]) - i - j);
        }
    }
    cout << ans << '\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 492 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 492 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 492 KB Output isn't correct
2 Halted 0 ms 0 KB -