Submission #878678

# Submission time Handle Problem Language Result Execution time Memory
878678 2023-11-25T04:56:40 Z Sir_Ahmed_Imran Sure Bet (CEOI17_sure) C++17
60 / 100
70 ms 8716 KB
                            ///~~~LOTA~~~///
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define append push_back
#define add insert
#define nl '\n'
#define ff first
#define ss second
#define panic break 
#define pii pair<int,int>
#define pic pair<int,char>
#define all(x) (x).begin(),(x).end()
#define sum(a) accumulate(all(a),0)
#define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL)
#define terminator main
#define N 2001
ld prex[N];
ld prey[N];
void solve(){
    int n;
    ld o,p,q;
    cin>>n;
    vector<ld> x,y;
    for(int i=o=0;i<n;i++){
        cin>>p>>q;
        x.append(p);
        y.append(q);
    }
    sort(all(x));
    sort(all(y));
    for(int i=0;i<N;i++)
        prex[i]=prey[i]=0;
    for(int i=n-1;i>=0;i--){
        prex[n-i]=prex[n-i-1]+x[i];
        prey[n-i]=prey[n-i-1]+y[i];
    }
    for(int i=1;i<=2*n;i++)
        for(int j=0;j<=i;j++)
            o=max(o,min(prex[j],prey[i-j])-i);
    cout<<o;      
}
int terminator(){
    L0TA;
    cout<<fixed<<setprecision(4);
    solve();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 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 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 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 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 10 ms 344 KB Output is correct
13 Correct 9 ms 348 KB Output is correct
14 Correct 10 ms 348 KB Output is correct
15 Correct 10 ms 588 KB Output is correct
16 Correct 10 ms 580 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 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 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 10 ms 344 KB Output is correct
13 Correct 9 ms 348 KB Output is correct
14 Correct 10 ms 348 KB Output is correct
15 Correct 10 ms 588 KB Output is correct
16 Correct 10 ms 580 KB Output is correct
17 Runtime error 70 ms 8716 KB Execution killed with signal 11
18 Halted 0 ms 0 KB -