Submission #169426

# Submission time Handle Problem Language Result Execution time Memory
169426 2019-12-20T10:15:52 Z Ruxandra985 Sure Bet (CEOI17_sure) C++14
0 / 100
3 ms 504 KB
/// sunt foarte inteligenta nu stiu sa citesc enunturi
#include <bits/stdc++.h>
#define DIMN 100010
using namespace std;
pair <double , int> v[DIMN],w[DIMN];
int main()
{
    FILE *fin = fopen ("a.in","r");
    FILE *fout = fopen ("a.out","w");
    int n , i , j , taken = 0;
    double sol = 0.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++){
            sx += v[n-i+1].first;
            taken = 0;
            sy = 0.0;
            for (j=n;j;j--){
                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:9:11: warning: unused variable 'fout' [-Wunused-variable]
     FILE *fout = fopen ("a.out","w");
           ^~~~
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 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -