# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
865220 |
2023-10-24T06:36:51 Z |
vjudge1 |
Sure Bet (CEOI17_sure) |
C++17 |
|
2000 ms |
1872 KB |
#include <bits/stdc++.h>
#define ll long long
#define Sayan ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)
#define all(a) a.begin() , a.end()
#define Int(a,x) a+1 , a+1+x
#define sz() size()
#define F first
#define S second
#define pb push_back
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define pii pair<ll,ll>
using namespace std ;
const ll N = 1e5+5;
const ll INF = 1e18;
const ll mod = 1e9+7;
/*
ll binpow(ll a , ll b){
if(b == 0) return 1;
if(b%2) return binpow(a , b-1) * a % mod;
ll c = binpow(a , b/2) % mod;
return c*c%mod;
}
*/
double l[N],r[N];
void solve(){
ll n;
cin>>n;
double mx=0;
for(ll i=1;i<=n;i++){
cin>>l[i]>>r[i];
}
sort(l+1,l+1+n);
reverse(l+1,l+1+n);
sort(r+1,r+1+n);
reverse(r+1,r+1+n);
double pr1=0;
for(ll i=1;i<=n;i++){
pr1+=l[i];
double sum=i;
double pr2=0;
for(ll j=1;j<=n;j++){
pr2+=r[j];
double sumo=sum+j;
double mn=min(pr1-sumo,pr2-sumo);
if(mn>mx){
mx=mn;
}
}
}
cout<<fixed<<setprecision(4)<<mx<<"\n";
}
signed main () {
Sayan;
ll t=1;
//cin>>t;
while(t--)solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
2 ms |
348 KB |
Output is correct |
13 |
Correct |
2 ms |
348 KB |
Output is correct |
14 |
Correct |
2 ms |
348 KB |
Output is correct |
15 |
Correct |
2 ms |
348 KB |
Output is correct |
16 |
Correct |
2 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
2 ms |
348 KB |
Output is correct |
13 |
Correct |
2 ms |
348 KB |
Output is correct |
14 |
Correct |
2 ms |
348 KB |
Output is correct |
15 |
Correct |
2 ms |
348 KB |
Output is correct |
16 |
Correct |
2 ms |
348 KB |
Output is correct |
17 |
Execution timed out |
2049 ms |
1872 KB |
Time limit exceeded |
18 |
Halted |
0 ms |
0 KB |
- |