답안 #321840

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
321840 2020-11-13T12:43:37 Z Karen124 Sure Bet (CEOI17_sure) C++14
0 / 100
1 ms 364 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 = 1000 + 10;
const ll LOG = 20;
const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 10;
int n;
double a[N], b[N], ans = -2.0 * N, psa[N], psb[N];
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n;
    for (int i = 1; i <= n; i++){
        cin >> a[i] >> b[i];
    }
    sort(a + 1, a + n + 1); sort(b + 1, b + n + 1);
    reverse(a + 1, a + n + 1); reverse(b + 1, b + n + 1);
    for (int i = 1; i <= n; 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[i], psb[j]) - (double)(i + j));
        }
    }
    cout << fixed << setprecision(4) << ans << '\n';
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -