답안 #169427

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
169427 2019-12-20T10:16:14 Z Ruxandra985 Sure Bet (CEOI17_sure) C++14
60 / 100
6 ms 380 KB
#include <bits/stdc++.h>
#define DIMN 100010
using namespace std;
pair <double , int> v[DIMN],w[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++){
            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:10: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:13: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 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 380 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 368 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 6 ms 376 KB Output is correct
13 Correct 6 ms 376 KB Output is correct
14 Correct 6 ms 376 KB Output is correct
15 Correct 6 ms 376 KB Output is correct
16 Correct 6 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 380 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 368 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 6 ms 376 KB Output is correct
13 Correct 6 ms 376 KB Output is correct
14 Correct 6 ms 376 KB Output is correct
15 Correct 6 ms 376 KB Output is correct
16 Correct 6 ms 376 KB Output is correct
17 Incorrect 2 ms 376 KB Output isn't correct
18 Halted 0 ms 0 KB -