Submission #1005705

# Submission time Handle Problem Language Result Execution time Memory
1005705 2024-06-22T20:42:53 Z ayankarimova Rice Hub (IOI11_ricehub) C++14
25 / 100
8 ms 3676 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
const ll sz=50005;
ll a[sz], b[sz], d[sz], p[sz];
int besthub(int num, int le, int x[], long long k)
{

    for(int i=0; i<num; i++){
        p[i+1]=p[i]+x[i];
    }
    ll l=1, r=num, ans=0;
    while(l<=r){
        ll mid=(l+r)/2;
        ll num=x[mid-1]*(mid-l)-p[mid-1]+p[l-1]+p[r]-p[mid]-x[mid-1]*(r-mid);
        //cout<<l<<' '<<r<<' '<<num<<' '<<p[r-1]-p[mid-1]<<endl;
        if(num<=k){
            ans=max(ans, r-l+1);
            r--;
        }
        else{
            l++;
        }
    }
    return ans;
}
/*
{} []
5 20 6
1
2
10
12
14
3

1 3 13 25 39

12*2-10+39-13-12*1=12+16
*/
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Incorrect 1 ms 2396 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 0 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 0 ms 2396 KB Output is correct
18 Correct 0 ms 2396 KB Output is correct
19 Correct 0 ms 2396 KB Output is correct
20 Correct 0 ms 2492 KB Output is correct
21 Correct 0 ms 2396 KB Output is correct
22 Correct 0 ms 2396 KB Output is correct
23 Correct 0 ms 2396 KB Output is correct
24 Correct 0 ms 2396 KB Output is correct
25 Correct 0 ms 2396 KB Output is correct
26 Correct 0 ms 2396 KB Output is correct
27 Correct 0 ms 2396 KB Output is correct
28 Correct 0 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2408 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 1 ms 2492 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Incorrect 1 ms 2396 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2652 KB Output is correct
2 Correct 2 ms 2624 KB Output is correct
3 Correct 8 ms 3632 KB Output is correct
4 Correct 8 ms 3676 KB Output is correct
5 Correct 4 ms 2908 KB Output is correct
6 Correct 4 ms 2860 KB Output is correct
7 Correct 7 ms 3264 KB Output is correct
8 Correct 7 ms 3420 KB Output is correct
9 Correct 4 ms 2908 KB Output is correct
10 Correct 3 ms 2776 KB Output is correct
11 Correct 8 ms 3528 KB Output is correct
12 Correct 8 ms 3676 KB Output is correct
13 Incorrect 4 ms 2908 KB Output isn't correct
14 Halted 0 ms 0 KB -