Submission #281835

# Submission time Handle Problem Language Result Execution time Memory
281835 2020-08-23T14:24:39 Z neki Sure Bet (CEOI17_sure) C++14
60 / 100
5 ms 640 KB
#include <bits/stdc++.h>
//#include "icc.h"
#define loop(i, a, b) for(long long i=a;i<b;i++)
#define pool(i, a, b) for(long long i=a-1;i>=b;i--)
#define fore(i, a) for(auto&& i:a)
#define fi first
#define se second
#define ps(a) push_back(a)
#define vc vector
#define pa pair<ll, ll>
#define ll long long
#define all(a) a.begin(), a.end()
using namespace std;
#define mn 2010
#define pa pair<ll, ll>
#define ld long double
ld a[mn], b[mn];
ld min(ld a, ld b){return (a<b) ? a:b;}
ld max(ld a, ld b){return (a>b) ? a:b;}
int main(){
    ll n;cin >> n;
    loop(i, 1, n+1) cin >> a[i]>>b[i];
    sort(a+1, a+n+1, greater<ld> ()); loop(i, 1, n+1) a[i]+=a[i-1];
    sort(b+1, b+n+1, greater<ld> ()); loop(i, 1, n+1) b[i]+=b[i-1];
    ld ans=0.0;
    ll j=0;
    loop(i, 0, n+1){
        while(j<n and min(a[i], b[j])-(ld)i-(ld)j<=min(a[i], b[j+1])-(ld)i-(ld)j-(ld)1) j++;
        ans=max(ans, min(a[i], b[j])-(ld)i-(ld)j);
    }
    cout << fixed << setprecision(4)<<ans<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 3 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 3 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
17 Runtime error 5 ms 640 KB Execution killed with signal 11
18 Halted 0 ms 0 KB -