Submission #1110348

# Submission time Handle Problem Language Result Execution time Memory
1110348 2024-11-09T09:49:25 Z sofija6 Sure Bet (CEOI17_sure) C++14
100 / 100
63 ms 3656 KB
#include <bits/stdc++.h>
#define ll int
#define MAXN 100010
using namespace std;
double a[MAXN],b[MAXN];
bool Cmp(double x,double y)
{
    return x>y;
}
int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll n;
    cin >> n;
    for (ll i=1;i<=n;i++)
    {
        cin >> a[i] >> b[i];
        a[i]-=1;
        b[i]-=1;
    }
    sort(a+1,a+1+n,Cmp);
    sort(b+1,b+1+n,Cmp);
    double cura=0,curb=0,ans=0;
    ll posb=1;
    for (ll i=1;i<=n;i++)
    {
        cura+=a[i];
        curb--;
        while (posb<=n && min(cura-1,curb+b[posb])>=min(cura,curb))
        {
            curb+=b[posb];
            cura--;
            posb++;
        }
        ans=max(ans,min(cura,curb));
    }
    cout << fixed << setprecision(4) << ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 504 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 500 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 504 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 500 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 51 ms 3144 KB Output is correct
18 Correct 63 ms 3212 KB Output is correct
19 Correct 52 ms 3144 KB Output is correct
20 Correct 63 ms 3380 KB Output is correct
21 Correct 60 ms 3656 KB Output is correct
22 Correct 52 ms 3144 KB Output is correct
23 Correct 55 ms 3144 KB Output is correct
24 Correct 56 ms 3220 KB Output is correct
25 Correct 57 ms 3180 KB Output is correct
26 Correct 59 ms 3520 KB Output is correct