# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
964289 | 2024-04-16T14:55:33 Z | pcc | Sure Bet (CEOI17_sure) | C++17 | 0 ms | 352 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long #define pll pair<ll,ll> #define pii pair<int,int> #define fs first #define sc second #define tlll tuple<ll,ll,ll> const int mxn = 1e5+10; ll N; ll arr[mxn],brr[mxn]; int main(){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); scanf("%d",&N); for(int i = 1;i<=N;i++){ float f; scanf("%f",&f); arr[i] = f*10000; scanf("%f",&f); brr[i] = f*10000; } sort(arr+1,arr+N+1,greater<ll>()); sort(brr+1,brr+1+N,greater<ll>()); for(int i = 1;i<=N;i++){ arr[i] += arr[i-1]; brr[i] += brr[i-1]; } ll ans = 0; for(int i = 1;i<=N;i++){ ll l = 0,r = i; while(l != r){ int mid = (l+r+1)>>1; if(arr[mid]>brr[i-mid])r = mid-1; else l = mid; } ans = max(ans,min(arr[l],brr[i-l])-i*10000); l++; if(l<=i)ans = max(ans,min(arr[l],brr[i-l])-i*10000); } printf("%.4lf",(double)ans/10000); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 352 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 352 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 352 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |