# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
330448 |
2020-11-25T09:19:34 Z |
Sho10 |
Sure Bet (CEOI17_sure) |
C++14 |
|
133 ms |
5228 KB |
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#define ll long long
#define double long double
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod (10*10*10*10*10*10*10*10*10+7)
#define PI 3.14159265359
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005ll
#define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll n;
double a[100005],b[100005];
int32_t main(){
CODE_START;
cin>>n;
for(ll i=1;i<=n;i++)
{
cin>>a[i]>>b[i];
a[i]--;
b[i]--;
}
sort(a+1,a+n+1);
sort(b+1,b+n+1);
reverse(a+1,a+n+1);
reverse(b+1,b+n+1);
double ans=0;
double s1=0,s2=0;
ll i=1,j=1;
while(i<=n){
s1+=(double)a[i];
// cout<<fixed<<setprecision(8)<<s1<<endl;
i++;
while(j<=n&&min((double)(s1-j),(double)(s2-i))<min((double)(s1-(double)(j+1)),(double)(s2+b[j]-i))){
s2+=(double)b[j];
j++;
}
ans=max(ans,min(s1-j+1,s2-i+1));
}
cout<<fixed<<setprecision(4)<<ans<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
1 ms |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
2 ms |
364 KB |
Output is correct |
13 |
Correct |
2 ms |
364 KB |
Output is correct |
14 |
Correct |
3 ms |
364 KB |
Output is correct |
15 |
Correct |
2 ms |
364 KB |
Output is correct |
16 |
Correct |
2 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
1 ms |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
2 ms |
364 KB |
Output is correct |
13 |
Correct |
2 ms |
364 KB |
Output is correct |
14 |
Correct |
3 ms |
364 KB |
Output is correct |
15 |
Correct |
2 ms |
364 KB |
Output is correct |
16 |
Correct |
2 ms |
364 KB |
Output is correct |
17 |
Correct |
133 ms |
4844 KB |
Output is correct |
18 |
Correct |
122 ms |
4844 KB |
Output is correct |
19 |
Correct |
128 ms |
4844 KB |
Output is correct |
20 |
Correct |
116 ms |
4836 KB |
Output is correct |
21 |
Correct |
127 ms |
5228 KB |
Output is correct |
22 |
Correct |
119 ms |
4844 KB |
Output is correct |
23 |
Correct |
120 ms |
4960 KB |
Output is correct |
24 |
Correct |
118 ms |
4972 KB |
Output is correct |
25 |
Correct |
116 ms |
4844 KB |
Output is correct |
26 |
Correct |
125 ms |
5228 KB |
Output is correct |