Submission #113604

# Submission time Handle Problem Language Result Execution time Memory
113604 2019-05-26T18:07:47 Z Vardanyan Sure Bet (CEOI17_sure) C++14
20 / 100
3 ms 384 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 100*1000+5;
pair<double,double> a[N];
double prefa[N],prefb[N];
int main()
{
    ios_base::sync_with_stdio(false);

    int n;
    cin>>n;
    for(int i = 1;i<=n;i++) cin>>a[i].first>>a[i].second;
    sort(a+1,a+1+n);
    reverse(a+1,a+1+n);
    for(int i = 1;i<=n;i++) prefa[i] = prefa[i-1]+a[i].first;
    for(int i = 1;i<=n;i++) swap(a[i].first,a[i].second);
    sort(a+1,a+1+n);
    reverse(a+1,a+1+n);
    for(int i = 1;i<=n;i++) prefb[i] = prefb[i-1]+a[i].first;
    double ans = 0;
    for(int i = 0;i<=n;i++){
        for(int j = max(0,i-100);j<=min(n,i+100);j++){
            ans = max(ans,min(prefa[i],prefb[j])-(i+j));
        }
    }
    printf("%.4lf",(double)ans);
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 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 Incorrect 3 ms 384 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 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 Incorrect 3 ms 384 KB Output isn't correct
16 Halted 0 ms 0 KB -