Submission #1005864

# Submission time Handle Problem Language Result Execution time Memory
1005864 2024-06-23T07:21:06 Z hacizadal Rice Hub (IOI11_ricehub) C++17
0 / 100
3 ms 2488 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define pll pair<ll, ll>
ll p[100005];

int besthub(int n, int k, int a[], long long b)
{
    for (ll i = 0; i<n; i++){
        p[i+1] = p[i] + a[i];
    }
    ll l = 0, r = 0, mx = 0;
    while (r < n){
        ll mid = (l + r)/2;
        ll sum = (p[r+1] - p[mid+1]) - a[mid]*(r-mid) + a[mid]*(mid-l) - (p[mid+1] - p[l+1]);
        if (sum <= b){
            mx = max(mx, r-l+1);
            r++;
        }
        else {
            l++;
        }
    }
    return mx;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Incorrect 0 ms 2488 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 2488 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Incorrect 0 ms 2396 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -