Submission #418263

# Submission time Handle Problem Language Result Execution time Memory
418263 2021-06-05T08:53:22 Z temurbek_khujaev Rice Hub (IOI11_ricehub) C++17
0 / 100
5 ms 664 KB
#include "ricehub.h"
#include <bits/stdc++.h>

using namespace std;

int besthub(int R, int L, int X[], long long B) {
    int ans = 0;
    int l = 0;
    int r = 0;

    for (int i = 0; i < R; i++) {
        if (i > 0) {
            B -= 1ll * (X[i] - X[i - 1]) * (i - l);
            B += 1ll * (X[i] - X[i - 1]) * (r - i);
        }
        while (B < 0) {
            B += X[i] - X[l];
            l++;
        }
        while (r < R && B >= X[r] - X[i]) {
            B -= X[r] - X[i];
            r++;
        }
        while (r < R && B + X[i] - X[l] >= X[r] - X[i]) {
            B += X[i] - X[l] - X[r] - X[i];
            r++;
        }
        ans = max(ans, r - l);
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 304 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Incorrect 1 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Incorrect 1 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 664 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -