Submission #841510

#TimeUsernameProblemLanguageResultExecution timeMemory
841510treewaveSure Bet (CEOI17_sure)C++17
0 / 100
1 ms212 KiB
#include <bits/stdc++.h> using namespace std; #define double long double int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector<double> a(n), b(n); for (int i = 0; i < n; i++){ cin >> a[i] >> b[i]; } sort(a.rbegin(), a.rend()); sort(b.rbegin(), b.rend()); double ans = 0, sa = 0, sb = 0, ptr_a = 0, ptr_b = 0; for (int i = 1; i <= 2 * n; i++){ if (sa < sb && ptr_a != n){ sa += a[ptr_a]; ptr_a++; } else{ sb += b[ptr_b]; ptr_b++; } ans = max(ans, min(sa, sb) - i); } printf("%.4lf\n", ans); }

Compilation message (stderr)

sure.cpp: In function 'int main()':
sure.cpp:31:17: warning: format '%lf' expects argument of type 'double', but argument 2 has type 'long double' [-Wformat=]
   31 |     printf("%.4lf\n", ans);
      |             ~~~~^     ~~~
      |                 |     |
      |                 |     long double
      |                 double
      |             %.4Lf
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...