Submission #570764

# Submission time Handle Problem Language Result Execution time Memory
570764 2022-05-31T09:01:00 Z choigameautohackrb Sure Bet (CEOI17_sure) C++17
60 / 100
6 ms 468 KB
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
const ll N=1e3+7;
ld tmpA, tmpB, ans, a[N], b[N], PreA[N], PreB[N];
ll tmp, n;
bool maximize(ld &a, ld b){
    if (a<b){
        a=b;
        return 1;
    } else return 0;
}
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin>>n;
    for (int i=1;i<=n;i++) cin>>a[i]>>b[i];
    sort(a+1, a+1+n, greater<ld>());
    sort(b+1, b+1+n, greater<ld>());
    for (int i=1;i<=n;i++){
        PreA[i]=PreA[i-1]+a[i];
        PreB[i]=PreB[i-1]+b[i];
    }
    for (int i=1;i<=n;i++)
    for (int j=1;j<=n;j++){
        tmp=i+j; tmpA=PreA[i]-tmp;   tmpB=PreB[j]-tmp;
        maximize(ans, min(tmpA, tmpB));
    }
    cout<<fixed<<setprecision(4)<<ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 5 ms 340 KB Output is correct
13 Correct 6 ms 340 KB Output is correct
14 Correct 5 ms 340 KB Output is correct
15 Correct 5 ms 340 KB Output is correct
16 Correct 5 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 5 ms 340 KB Output is correct
13 Correct 6 ms 340 KB Output is correct
14 Correct 5 ms 340 KB Output is correct
15 Correct 5 ms 340 KB Output is correct
16 Correct 5 ms 340 KB Output is correct
17 Runtime error 1 ms 468 KB Execution killed with signal 11
18 Halted 0 ms 0 KB -