Submission #865514

#TimeUsernameProblemLanguageResultExecution timeMemory
865514vjudge1Sure Bet (CEOI17_sure)C++17
20 / 100
1 ms536 KiB
/*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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...