Submission #46504

# Submission time Handle Problem Language Result Execution time Memory
46504 2018-04-21T05:19:00 Z 1Khan Sure Bet (CEOI17_sure) C++11
60 / 100
2000 ms 4300 KB
#include <bits/stdc++.h>

using namespace std;

#define Tupizm ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);

#define ONE exit(0);
#define nl "\n"

#define all(x) x.begin(0), x.end(0);
#define sz(x) (int)x.size();

#define pb push_back
#define ppb pop_back

typedef long long ll;
typedef double db;

const int N = 1e5 + 5;
const int M = 1e9 + 7;

int n;
double a[N], b[N];
double ans;
double c[N], d[N];
int main(){
    
    Tupizm
    
    cin >> n;
    for(int i = 1; i <= n; ++i){
        cin >> a[i] >> b[i];
    }
    sort(a + 1, a + n + 1);
    sort(b + 1, b + n + 1);
    for(int i = n; i >= 1; --i){
        c[i] = c[i + 1] + a[i];
        d[i] = d[i + 1] + b[i];
    }
    reverse(c + 1, c + n + 1);
    reverse(d + 1, d + n + 1);
    for(int i = 1; i <= n; ++i){
    }
    for(int i = 0; i <= n; ++i){
        for(int j = 0; j <= n; ++j){
            ans = max(ans, (double)(min(c[i], d[j]) - (i + j)));
        }
    }
    cout << fixed << setprecision(4) << (db)ans << nl;
    ONE
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 432 KB Output is correct
4 Correct 2 ms 488 KB Output is correct
5 Correct 2 ms 492 KB Output is correct
6 Correct 2 ms 496 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 432 KB Output is correct
4 Correct 2 ms 488 KB Output is correct
5 Correct 2 ms 492 KB Output is correct
6 Correct 2 ms 496 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 2 ms 504 KB Output is correct
9 Correct 9 ms 512 KB Output is correct
10 Correct 2 ms 512 KB Output is correct
11 Correct 2 ms 552 KB Output is correct
12 Correct 6 ms 580 KB Output is correct
13 Correct 5 ms 580 KB Output is correct
14 Correct 5 ms 604 KB Output is correct
15 Correct 5 ms 636 KB Output is correct
16 Correct 5 ms 780 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 432 KB Output is correct
4 Correct 2 ms 488 KB Output is correct
5 Correct 2 ms 492 KB Output is correct
6 Correct 2 ms 496 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 2 ms 504 KB Output is correct
9 Correct 9 ms 512 KB Output is correct
10 Correct 2 ms 512 KB Output is correct
11 Correct 2 ms 552 KB Output is correct
12 Correct 6 ms 580 KB Output is correct
13 Correct 5 ms 580 KB Output is correct
14 Correct 5 ms 604 KB Output is correct
15 Correct 5 ms 636 KB Output is correct
16 Correct 5 ms 780 KB Output is correct
17 Execution timed out 2062 ms 4300 KB Time limit exceeded
18 Halted 0 ms 0 KB -