Submission #122616

#TimeUsernameProblemLanguageResultExecution timeMemory
122616davitmargSure Bet (CEOI17_sure)C++17
0 / 100
2 ms256 KiB
/*DavitMarg*/ #include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <string> #include <cstring> #include <map> #include <unordered_map> #include <bitset> #include <set> #include <queue> #include <deque> #include <stack> #include <iterator> #include <ctype.h> #include <stdlib.h> #include <cassert> #include <fstream> #define mod 998244353ll #define LL long long #define LD long double #define MP make_pair #define PB push_back #define all(v) v.begin(),v.end() using namespace std; int n,k; double a[100005],b[100005],sx,sy,ans=-mod; int main() { cin>>n; for(int i=1;i<=n;i++) cin>>a[i]>>b[i]; sort(a+1,a+1+n); sort(b+1,b+1+n); reverse(a+1,a+1+n); reverse(b+1,b+1+n); for(int i=1;i<=n;i++) { sx+=a[i]; while(k<n && min(sx,sy+b[k+1])-i-k-1>=min(sx,sy)-i-k) { k++; sy+=b[k]; } ans=max(ans,min(sx,sy)-i-k); } printf("%.4f\n",ans); return 0; } /* */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...