답안 #1027496

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1027496 2024-07-19T07:05:19 Z vjudge1 Sure Bet (CEOI17_sure) C++17
100 / 100
62 ms 1992 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    double a[n+1],b[n+1];
    for(int i=1;i<=n;i++){
        cin>>a[i]>>b[i];
        a[i]--;
        b[i]--;
    }
    sort(a+1,a+n+1,greater<double>());
    sort(b+1,b+n+1,greater<double>());
    int j=0;
    double sa=0,sb=0,res=0;
    for(int i=1;i<=n;i++){
        sa+=a[i];
        while(j<=n && (min(sa-j,sb-i)<min(sa-(j+1),(sb+b[j+1])-i))){
            j++;
            sb+=b[j];
        }
        res=max(res,min(sa-j,sb-i));
    }
    cout<<fixed<<setprecision(4)<<res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 448 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 0 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 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 448 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 50 ms 1880 KB Output is correct
18 Correct 45 ms 1880 KB Output is correct
19 Correct 48 ms 1884 KB Output is correct
20 Correct 47 ms 1884 KB Output is correct
21 Correct 48 ms 1880 KB Output is correct
22 Correct 51 ms 1884 KB Output is correct
23 Correct 46 ms 1880 KB Output is correct
24 Correct 48 ms 1884 KB Output is correct
25 Correct 47 ms 1884 KB Output is correct
26 Correct 62 ms 1992 KB Output is correct