# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
865514 |
2023-10-24T09:17:36 Z |
vjudge1 |
Sure Bet (CEOI17_sure) |
C++17 |
|
1 ms |
536 KB |
/*Lazy propagation 21
*
*
* Imansoska228
* Imancrush
* Imantopchik
* .*n*.
* Author: Imansoska
* Slishkom slab
**/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FF first
#define SS second
#define pb push_back
#define bp pop_back()
#define pf push_front
#define int long long
#define Imansoska ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define endl cout << "\n"
//#define input cin
//#define print cout
const int N = 1e5 + 13 ;
const int maxn= 1e6+100;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int ima = 1e4 + 10;
int n;
double z[100010] , s[100010];
double g1 , g2;
signed main (/*Imansoska*/) {
Imansoska
// freopen("lepus.in","r",stdin);
// freopen("lepus.out","w",stdout);
cin >> n;
for ( int i=1; i<=n; i++ ) {
cin >> z[i] >> s[i];
}
sort( z+1 , z+1+n );
sort( s+1 , s+1+n );
int l=n-1 , r=n-1 ;
double mx=-9999999;
g1=z[n]-2;
g2=s[n]-2;
mx=max(mx , min(g1,g2));
for ( int i=1; i<=n*2; i++ ) {
mx=max(mx , min(g1 , g2));
if ( g1<g2 ) {
g1+=z[l]-1;
l--;
g2-=1.0;
}
mx=max(mx , min(g1 , g2));
if ( g2<g1 ) {
g2+=s[r]-1;
r--;
g1-=1.0;
}
mx=max(mx , min(g1 , g2));
}
mx=max(mx , 0.0);
printf("%.4lf",(double)mx);
}
# |
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 |
536 KB |
Output is correct |
5 |
Correct |
0 ms |
348 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 |
536 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
536 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |