답안 #361628

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
361628 2021-01-30T20:56:34 Z bigDuck Sure Bet (CEOI17_sure) C++14
100 / 100
95 ms 3728 KB
#include<bits/stdc++.h>
using namespace std;
#define INIT  ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>
#define count_bits __builtin_popcount
#define int ll

int t, n, m, k, a[300010],  l, r;
int b[100010];


int q=1000000000;

int32_t main(){
INIT
cin>>n;
for(int i=1; i<=n; i++){
    long double d, c; cin>>c>>d;
    a[i]=c*q;
    if( (a[i]%(q/10000))>0 ){
        a[i]=a[i]-(a[i]%(q/10000))+(q/10000);
    }

    b[i]=d*q;
    if( (b[i]%(q/10000))>0 ){
        b[i]=b[i]-(b[i]%(q/10000))+(q/10000);
    }
}

sort(b+1, b+1+n);
sort(a+1, a+1+n);




int j=0;
int s1=0, s2=0;
int res=0;

for(int i=1; i<=n; i++){
    s1+=a[n-i+1];
    res=max(res, min(s1,s2)-(i+j)*q);
    while( (s2<s1) && (j<n) ){
        res=max(res, min(s1, s2)-(i+j)*q);
        j++;
        s2+=b[n-j+1];
        res=max(res, min(s1,s2)-(i+j)*q);
    }
    res=max(res, min(s1,s2)-(i+j)*q);
}
double a=res, b=q;
cout<<fixed<<setprecision(4)<<(a/b);



return 0;
}



# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 376 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 376 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 2 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 376 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 2 ms 364 KB Output is correct
17 Correct 85 ms 3308 KB Output is correct
18 Correct 84 ms 3280 KB Output is correct
19 Correct 87 ms 3436 KB Output is correct
20 Correct 90 ms 3308 KB Output is correct
21 Correct 95 ms 3728 KB Output is correct
22 Correct 84 ms 3308 KB Output is correct
23 Correct 91 ms 3456 KB Output is correct
24 Correct 88 ms 3308 KB Output is correct
25 Correct 89 ms 3308 KB Output is correct
26 Correct 95 ms 3692 KB Output is correct