Submission #121233

# Submission time Handle Problem Language Result Execution time Memory
121233 2019-06-26T08:42:54 Z miguel Sure Bet (CEOI17_sure) C++14
0 / 100
2 ms 384 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<double>
#define pb push_back
#define INF 1e9+7
int n;
vi a, b;

int main(){
    cin>>n;
    //random_device dev;
    //mt19937 rng(dev());
    //uniform_int_distribution<std::mt19937::result_type> dist6(5,6);
    //srand((unsigned)time(0));
    //int i;
    //i=(rand()%2)+5;
    a.pb(INF); b.pb(INF);
    for(int i=1; i<=n; i++){
        double x,y;
        cin>>x>>y;
        a.pb(x);
        b.pb(y);
    }
    sort(a.begin(), a.end(), greater<double>());
    sort(b.begin(), b.end(), greater<double>());
    //for(int i=1; i<=n; i++) cout<<a[i]<<" ";cout<<endl;
    a[0]=0; b[0]=0;
    for(int i=1; i<=n; i++){
        a[i]+=a[i-1];
    }
    for(int i=1; i<=n; i++){
        b[i]+=b[i-1];
    }
    int x=0, y=0; double mx=0;
    for(int i=0; i<=n; i++){
        for(int j=0; j<=n; j++){
            int t=i+j;

            mx=max(min(a[i]-t, b[j]-t), mx);//cout<<min(a[i]-t, b[j]-t)<<" "<<i<<" "<<j<<endl;
        }
    }
    cout<<mx;
}

Compilation message

sure.cpp: In function 'int main()':
sure.cpp:35:9: warning: unused variable 'x' [-Wunused-variable]
     int x=0, y=0; double mx=0;
         ^
sure.cpp:35:14: warning: unused variable 'y' [-Wunused-variable]
     int x=0, y=0; double mx=0;
              ^
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -