답안 #1027250

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1027250 2024-07-19T02:46:37 Z coin_ Sure Bet (CEOI17_sure) C++14
60 / 100
2000 ms 3528 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int n;
    cin >> n;
    double a[n+1], b[n+1];
    for (int i = 1; i <= n; i++){
        cin >> a[i] >> b[i];
    }
    sort(a+1, a+n+1, greater<double>());
    sort(b+1, b+n+1, greater<double>());
    double prefA[n+1] = {0}, prefB[n+1] = {0};
    prefA[1] = a[1];
    prefB[1] = b[1];
    for (int i = 2; i <= n; i++){
        prefA[i] = prefA[i-1] + a[i];
        prefB[i] = prefB[i-1] + b[i];
    }
    double ans = 0;
    for (int i = 1; i <= n; i++){
        int l = 1, r = n;
        while (l <= r){
            ans = max(ans, min(prefA[i] - (double)i - (double)l, prefB[l] - (double)i - (double)l));
            l++;
        }
    }
    cout << fixed << setprecision(4) << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 2 ms 348 KB Output is correct
13 Correct 3 ms 348 KB Output is correct
14 Correct 2 ms 600 KB Output is correct
15 Correct 3 ms 484 KB Output is correct
16 Correct 2 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 2 ms 348 KB Output is correct
13 Correct 3 ms 348 KB Output is correct
14 Correct 2 ms 600 KB Output is correct
15 Correct 3 ms 484 KB Output is correct
16 Correct 2 ms 348 KB Output is correct
17 Execution timed out 2077 ms 3528 KB Time limit exceeded
18 Halted 0 ms 0 KB -