Submission #1027261

#TimeUsernameProblemLanguageResultExecution timeMemory
1027261vjudge1Sure Bet (CEOI17_sure)C++14
60 / 100
2089 ms3528 KiB
#include <iostream> #include <vector> #include <algorithm> #pragma GCC optimize("03,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") 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.begin(), a.end(), greater<double>()); sort(b.begin(), b.end(), greater<double>()); vector<double> sum_a(n + 1, 0), sum_b(n + 1, 0); for(int i = 0; i < n; ++i) { sum_a[i + 1] = sum_a[i] + a[i] - 1; sum_b[i + 1] = sum_b[i] + b[i] - 1; } double ans = -1e9; for(int na = 0; na <= n; ++na) { for(int nb = 0; nb <= n; ++nb) { double cur = min(sum_a[na] - nb, sum_b[nb] - na); ans = max(cur, ans); } } printf("%.4lf",(double)ans); }

Compilation message (stderr)

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