답안 #877989

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
877989 2023-11-24T01:41:32 Z Sunlight Sure Bet (CEOI17_sure) C++14
60 / 100
104 ms 2016 KB
#include<bits/stdc++.h>
using namespace std;

const int MAX = 1e5 + 5;
double arr[MAX], brr[MAX];

int main()
{
    int n;
    cin >> n;

    for(int i = 1; i <= n; i ++) cin >> arr[i] >> brr[i];
    sort(arr + 1, arr + 1 + n, greater<double>());
    sort(brr + 1, brr + 1 + n, greater<double>());

    double sA = 0, sB = 0, ans = 0;
    int cA = 0, cB = 0;
    for(int i = 1; i <= 2 * n; i ++)
    {
        if(sA < sB and cA < n)
        {
            cA ++;
            sA += arr[cA];
        }
        else
        {
            cB ++;
            sB += brr[cB];
        }

        ans = max(ans, min(sA, sB) - i);
    }

    cout << fixed << setprecision(4) << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 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 432 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 1 ms 344 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 432 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 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 432 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 93 ms 1916 KB Output is correct
18 Correct 97 ms 2016 KB Output is correct
19 Correct 94 ms 1884 KB Output is correct
20 Correct 93 ms 1876 KB Output is correct
21 Incorrect 104 ms 1872 KB Output isn't correct
22 Halted 0 ms 0 KB -