답안 #121234

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
121234 2019-06-26T08:45:16 Z miguel Sure Bet (CEOI17_sure) C++14
60 / 100
2000 ms 3424 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;
        }
    }
    printf("%.4lf",(double)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;
              ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 356 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 356 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Execution timed out 2033 ms 3424 KB Time limit exceeded
18 Halted 0 ms 0 KB -