제출 #103715

#제출 시각아이디문제언어결과실행 시간메모리
103715E869120Sure Bet (CEOI17_sure)C++14
100 / 100
152 ms9488 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; #pragma warning (disable: 4996) long double A[100009], B[100009], maxn, v1, v2; int N; vector<long double>X; int main() { scanf("%d", &N); for (int i = 0; i < N; i++) { scanf("%Lf%Lf", &A[i], &B[i]); } sort(A, A + N); reverse(A, A + N); sort(B, B + N); reverse(B, B + N); long double s1 = 0; for (int i = 0; i <= N; i++) { X.push_back(s1); s1 += A[i]; } v1 = s1; long double s2 = 0; for (int i = 0; i <= N; i++) { X.push_back(s2); s2 += B[i]; } v2 = s2; sort(X.begin(), X.end()); for (int i = 0; i < X.size(); i++) { if (X[i] > min(v1, v2) + 1e-9) break; maxn = max(maxn, X[i] - 1.0L*i); } printf("%.4Lf\n", maxn); return 0; }

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

sure.cpp:5:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
 #pragma warning (disable: 4996)
 
sure.cpp: In function 'int main()':
sure.cpp:18:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < X.size(); i++) { if (X[i] > min(v1, v2) + 1e-9) break; maxn = max(maxn, X[i] - 1.0L*i); }
                  ~~^~~~~~~~~~
sure.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
  ~~~~~^~~~~~~~~~
sure.cpp:12:37: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for (int i = 0; i < N; i++) { scanf("%Lf%Lf", &A[i], &B[i]); }
                                ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...