# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
229446 | bharat2002 | Sure Bet (CEOI17_sure) | C++14 | 2064 ms | 4840 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
const int N=1e5 + 100;
const int mod=1e9 + 7;
#define int long long
const int inf=1e18;
#define pii pair<int, int>
#define f first
#define s second
#define mp make_pair
#define FOR(i, n) for(int i=1;i<=n;i++)
#define TRACE(x) cerr << #x << " = " << x << endl
//Trace prints the name of the variable and the value.
long double a[N], b[N];int n;
bool sf(long double f, long double s)
{
return f>s;
}
signed main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
cin>>n;
for(int i=1;i<=n;i++) cin>>a[i]>>b[i];
sort(a+1, a+n+1, sf);sort(b+1, b+n+1, sf);
for(int i=2;i<=n;i++) {a[i]+=a[i-1];b[i]+=b[i-1];}
int i=1, j=1;a[n+1]=b[n+1]=1000000000;
long double ans=0.0;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
ans=max(ans, min(a[i], b[j]) - i - j);
}
}
cout<<fixed<<setprecision(4)<<ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |