Submission #256664

#TimeUsernameProblemLanguageResultExecution timeMemory
256664ChrisTSure Bet (CEOI17_sure)C++17
100 / 100
75 ms3576 KiB
#include<bits/stdc++.h> using namespace std; int main () { int n; scanf ("%d",&n); vector<double> a(n),b(n); for (int i = 0; i < n; i++) scanf ("%lf %lf",&a[i],&b[i]); sort(a.rbegin(),a.rend()); sort(b.rbegin(),b.rend()); int bp = 0; double ret = 0, asum = 0, bsum = 0; int cnt = 0; for (int i = 0; i < n; i++) { asum += a[i]; ++cnt; while (bp < n && min(asum,bsum + b[bp]) - 1 >= min(asum,bsum)) { bsum += b[bp++]; ++cnt; } ret = max(ret,min(asum,bsum) - cnt); } printf ("%.4f\n",ret); return 0; }

Compilation message (stderr)

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