답안 #169425

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
169425 2019-12-20T10:13:19 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 = 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++){
            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:11: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:14: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);
             ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -