답안 #1027630

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1027630 2024-07-19T08:06:33 Z vjudge1 Sure Bet (CEOI17_sure) C++17
100 / 100
68 ms 3192 KB
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define all(v) begin(v), end(v)
#define pi pair<int, int>
#define vi vector<int>
using namespace std;
const int maxn = 1e5+3;
int n;
double a[maxn], b[maxn];
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i] >> b[i];
        a[i] = a[i] - 1.0;
        b[i] = b[i] - 1.0;
    }
    sort(a+1, a+n+1, greater<double>());
    sort(b+1, b+n+1, greater<double>());
    int i = 1, j = 1;
    double res = 0;
    double suma = 0, sumb = 0;
    while(i <= n){
        suma += a[i];
        i++;
        while(j <= n && min(suma - j + 1, sumb - i + 1) <= min(suma - j, sumb + b[j] - i + 1)){
            sumb += b[j];
            j++;
        }
        res = max(res, min(suma - j + 1, sumb - i + 1));
    }
    cout << fixed << setprecision(4) << res;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 600 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 1 ms 348 KB Output is correct
4 Correct 1 ms 600 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 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 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 476 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 468 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 1 ms 348 KB Output is correct
4 Correct 1 ms 600 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 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 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 476 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 468 KB Output is correct
17 Correct 50 ms 2900 KB Output is correct
18 Correct 51 ms 3028 KB Output is correct
19 Correct 50 ms 2896 KB Output is correct
20 Correct 49 ms 2896 KB Output is correct
21 Correct 61 ms 3192 KB Output is correct
22 Correct 53 ms 2944 KB Output is correct
23 Correct 59 ms 2920 KB Output is correct
24 Correct 65 ms 2900 KB Output is correct
25 Correct 51 ms 2900 KB Output is correct
26 Correct 68 ms 2900 KB Output is correct