Submission #169423

# Submission time Handle Problem Language Result Execution time Memory
169423 2019-12-20T10:10:02 Z Ruxandra985 Sure Bet (CEOI17_sure) C++14
0 / 100
2 ms 376 KB
#include <bits/stdc++.h>
#define DIMN 100010
using namespace std;
pair <double , int> v[DIMN],w[DIMN];
int f[DIMN];
int main()
{
    FILE *fin = stdin;

    int n , i , j , taken = 0;
    double sol = -2000000000.0 , sx , sy;
    fscanf (fin,"%d",&n);
    if (n <= 1000){
        for (i=1;i<=n;i++){
            fscanf (fin,"%lf%lf",&v[i].first,&w[i].first);
            v[i].second = w[i].second = i;
        }
        sort (v+1 , v + n + 1);
        sort (w+1 , w + n + 1);
        sx = 0.0;
        for (i=1;i<=n;i++){
            f[v[n-i+1].second] = 1;
            sx += v[n-i+1].first;
            taken = 0;
            sy = 0.0;
            for (j=n;j;j--){
                if (f[w[j].second] == 0){
                    sy += w[j].first;
                    taken++;
                    sol = max(sol , min(sx - i - taken , sy - i - taken));
                }
            }
        }
    }
    cout << setprecision(4) << fixed << sol;
    return 0;
}

Compilation message

sure.cpp: In function 'int main()':
sure.cpp:12:12: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     fscanf (fin,"%d",&n);
     ~~~~~~~^~~~~~~~~~~~~
sure.cpp:15:20: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             fscanf (fin,"%lf%lf",&v[i].first,&w[i].first);
             ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -