Submission #61714

#TimeUsernameProblemLanguageResultExecution timeMemory
61714IvanCSure Bet (CEOI17_sure)C++17
60 / 100
2100 ms5368 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 10; double A[MAXN],B[MAXN],pref_A[MAXN],pref_B[MAXN]; int N; double calcula(int x,int y){ return min(pref_A[x],pref_B[y]) - (x + y); } bool compara(double a,double b){ return a > b; } int main(){ double ans = 0.0; scanf("%d",&N); for(int i = 1;i<=N;i++){ scanf("%lf %lf",&A[i],&B[i]); } sort(A+1,A+N+1,compara); sort(B+1,B+N+1,compara); for(int i = 1;i<=N;i++){ pref_A[i] = pref_A[i-1] + A[i]; pref_B[i] = pref_B[i-1] + B[i]; } for(int a = 0;a<=N;a++){ for(int b = 0;b<=N;b++){ ans = max(ans, calcula(a,b) ); } } printf("%.4lf\n",ans); return 0; }

Compilation message (stderr)

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