제출 #169427

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

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

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