Submission #865482

# Submission time Handle Problem Language Result Execution time Memory
865482 2023-10-24T09:03:55 Z vjudge1 Sure Bet (CEOI17_sure) C++17
0 / 100
1 ms 2392 KB
/// tree bends in youth
/// 24  .10.2023
/// success is doing same thing in every single day!!!
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define all(x) x.begin(), x.end()
#define F first
#define S second
using namespace std;
const ll N =2e5+ 5;
const ll NN =2e6 + 5;
const ll INF = -1e1;
const ll MOD = 1e9 + 7;
const ll LG = 18;
const ll k = 316;
int n;
double a[N],b[N];
void solve(){
    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);
    double z = 0,x = 0;
    double ans = 0;
    for(int i = n;i > 0;i--){
        z += a[i];
        x = 0;
        for(int j = n;j >= int(n - z);j--){
            x += b[j];
            double cnt = (double(n) - double(i)) + (double(n) - double(j)) + double(2);
            ans = max(ans,min((z - cnt),(x - cnt)));
        }
    }
    cout <<fixed << setprecision(6) <<ans;
}
main (){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    ll abd= 1;
//    cin >> abd;
    for(ll i = 1;i <= abd;i++){
//        cout << "Case " << i << ":\n";
        solve();
    }
}

Compilation message

sure.cpp:39:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   39 | main (){
      | ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -