제출 #169423

#제출 시각아이디문제언어결과실행 시간메모리
169423Ruxandra985Sure Bet (CEOI17_sure)C++14
0 / 100
2 ms376 KiB
#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; }

컴파일 시 표준 에러 (stderr) 메시지

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...