Submission #914764

# Submission time Handle Problem Language Result Execution time Memory
914764 2024-01-22T16:14:25 Z DucNguyen2007 Rice Hub (IOI11_ricehub) C++14
68 / 100
1000 ms 3368 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxN=1e5+5;
ll sum[maxN+1];
int a[maxN+1];
ll get(ll l,ll r)
{
    if(l==0)
    {
        return sum[r];
    }
    else return sum[r]-sum[l-1];
}
ll besthub(int n,int L,int a[],ll B)
{
    sum[0]=a[0];
    for(int i=1;i<n;i++)
    {
        sum[i]=sum[i-1]+a[i];
    }
    ll res=0;
    for(int len=1;len<=n;len++)
    {
        ll l=0,r=len-1;
        while(r<n)
        {
            ll p=(l+r)/2;
            ll cur=(p-l+1)*a[p]-get(l,p)+get(p,r)-(r-p+1)*a[p];
            if(cur<=B)
            {
                res=max(res,1LL*len);
            }
            l++;
            r++;
        }
    }
    return res;
}
 
/*5 20 6
1 2 10 12 14*/
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2496 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2492 KB Output is correct
11 Correct 1 ms 2392 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2392 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2496 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2496 KB Output is correct
21 Correct 1 ms 2492 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2492 KB Output is correct
24 Correct 1 ms 2400 KB Output is correct
25 Correct 1 ms 2504 KB Output is correct
26 Correct 1 ms 2496 KB Output is correct
27 Correct 1 ms 2400 KB Output is correct
28 Correct 1 ms 2500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2408 KB Output is correct
2 Correct 1 ms 2508 KB Output is correct
3 Correct 2 ms 2408 KB Output is correct
4 Correct 2 ms 2508 KB Output is correct
5 Correct 1 ms 2512 KB Output is correct
6 Correct 1 ms 2408 KB Output is correct
7 Correct 2 ms 2512 KB Output is correct
8 Correct 2 ms 2512 KB Output is correct
9 Correct 1 ms 2508 KB Output is correct
10 Correct 1 ms 2408 KB Output is correct
11 Correct 2 ms 2408 KB Output is correct
12 Correct 1 ms 2508 KB Output is correct
13 Correct 2 ms 2392 KB Output is correct
14 Correct 2 ms 2396 KB Output is correct
15 Correct 1 ms 2492 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 2 ms 2496 KB Output is correct
18 Correct 2 ms 2392 KB Output is correct
19 Correct 2 ms 2496 KB Output is correct
20 Correct 2 ms 2396 KB Output is correct
21 Correct 28 ms 2504 KB Output is correct
22 Correct 28 ms 2396 KB Output is correct
23 Correct 30 ms 2512 KB Output is correct
24 Correct 31 ms 2500 KB Output is correct
25 Correct 29 ms 2396 KB Output is correct
26 Correct 29 ms 2504 KB Output is correct
27 Correct 29 ms 2396 KB Output is correct
28 Correct 29 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 478 ms 2472 KB Output is correct
2 Correct 424 ms 2392 KB Output is correct
3 Execution timed out 1058 ms 3368 KB Time limit exceeded
4 Halted 0 ms 0 KB -