제출 #51387

#제출 시각아이디문제언어결과실행 시간메모리
51387adamczh1Sure Bet (CEOI17_sure)C++17
0 / 100
2063 ms588 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN = 1e5 + 5; int n; double a[MAXN], b[MAXN]; ll A[MAXN], B[MAXN]; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%lf %lf", &a[i], &b[i]); A[i] = round(a[i] * 10000); B[i] = round(b[i] * 10000); } sort(A, A + n); reverse(A, A + n); sort(B, B + n); reverse(B, B + n); ll lo = 0; ll hi = 1e18; while (lo < hi) { ll mid = (lo + hi + 1) / 2; ll x = 0, y = 0; int ai = 0, bi = 0; while (ai < n || bi < n) { if (x < mid && ai < n) { x += A[ai++] - 10000; y -= 10000; } if (y < mid && bi < n) { x -= 10000; y += B[bi++] - 10000; } if (x >= mid && y >= mid) { break; } } if (x >= mid && y >= mid) { lo = mid; } else { hi = mid - 1; } } printf("%.4lf", 0.0001 * lo); return 0; }

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

sure.cpp: In function 'int main()':
sure.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
sure.cpp:14:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   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...