Submission #52651

#TimeUsernameProblemLanguageResultExecution timeMemory
52651snat123Sure Bet (CEOI17_sure)C++14
0 / 100
3 ms488 KiB
#include<bits/stdc++.h> using namespace std; int main(){ //ios_base::sync_with_stdio(false); //cin.tie(NULL); int n; cin >> n; double a[n], b[n]; for(int i=0; i<n; i++) cin >> a[i] >> b[i]; sort(a, a+n); sort(b, b+n); int i=n-1, j=n-1; long double x=0, y=0, res=0.0; while(i>=0 || j>=0){ if(x>=y || i<0){ y+=b[j--]; x-=1; y-=1; res=max(res, min(x, y)); } else{ x+=a[i--]; y-=1; x-=1; res=max(res, min(x, y)); } } printf("%.4lf", res); return 0; }

Compilation message (stderr)

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