# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1028358 |
2024-07-19T17:23:07 Z |
vjudge1 |
Sure Bet (CEOI17_sure) |
C++17 |
|
0 ms |
348 KB |
#include <bits/stdc++.h>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<ld,ld>
#define fi first
#define se second
#define endl "\n"
#define rep(a,b,c) for(ll a=b; a<c; a++)
#define rep2(a,b,c,d) for(ll a=b; a<c; a+=d)
#define repr(a,b,c) for(ll a=b-1; a>c-1; a--)
#define repa(a,b) for(const auto &a: b)
#define multicase() int t; cin>>t; while(t--)
#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define valid(c) cout<<(c ? "YES" : "NO")<<endl;
#define valid2(c,a,b) cout<<(c ? a : b)<<endl;
#define ll long long
#define ld long double
#define pq_min(a) priority_queue<a, vector<a>, greater<a>>
#define pq_max(a) priority_queue<a>
#define pb push_back
using namespace std;
int main(){
fastIO();
int n;
cin>>n;
ld a[n+5]{}, b[n+5]{}, ans=0;
int l, r, mid;
rep(i,1,n+1) cin>>a[i]>>b[i];
sort(a+1,a+n+5);
sort(b+1,b+n+5);
reverse(a+1,a+n+5);
reverse(b+1,b+n+5);
rep(i,1,n+1) a[i]+=a[i-1], b[i]+=b[i-1];
rep(i,1,n+1){
l=1;
r=n;
while(l<=r){
mid=(l+r)>>1;
if(b[mid]<=a[i]) l=mid+1;
else r=mid-1;
}
ans=max(ans,max(min(a[i],b[l])-i-l,min(a[i],b[r])-i-r));
}
cout<<ans<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |