Submission #235546

# Submission time Handle Problem Language Result Execution time Memory
235546 2020-05-28T13:34:49 Z Toirov_Sadi Rice Hub (IOI11_ricehub) C++17
68 / 100
1000 ms 1792 KB
#include<bits/stdc++.h>
#include "ricehub.h"

using namespace std;

int besthub(int n, int L, int X[], long long B){
    int res = 0;
    for(int i = 0; i < n; i ++){
        int l = i, r = i;
        long long ans = 0;
        while(l >= 0 && r < n){
            int x = INT_MAX;
            int y = INT_MAX;
            if(l > 0) x = X[i] - X[l - 1];
            if(r < n - 1) y = X[r + 1] - X[i];

            if(x < y && ans + x <= B) l --, ans += x;
            else if(y < x && ans + y <= B) r ++, ans += y;
            else if(x == y && x != INT_MAX && ans + x <= B) l --, ans += x;
            else break;
        }
        res = max(res, r - l + 1);
    }
    return res;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 4 ms 256 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 256 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 256 KB Output is correct
20 Correct 4 ms 256 KB Output is correct
21 Correct 5 ms 512 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 256 KB Output is correct
25 Correct 6 ms 384 KB Output is correct
26 Correct 6 ms 384 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
28 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 7 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 6 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 512 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 9 ms 384 KB Output is correct
14 Correct 7 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 8 ms 384 KB Output is correct
18 Correct 8 ms 384 KB Output is correct
19 Correct 9 ms 384 KB Output is correct
20 Correct 10 ms 384 KB Output is correct
21 Correct 8 ms 384 KB Output is correct
22 Correct 9 ms 384 KB Output is correct
23 Correct 85 ms 384 KB Output is correct
24 Correct 89 ms 416 KB Output is correct
25 Correct 118 ms 384 KB Output is correct
26 Correct 118 ms 384 KB Output is correct
27 Correct 41 ms 384 KB Output is correct
28 Correct 42 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 512 KB Output is correct
2 Correct 11 ms 512 KB Output is correct
3 Execution timed out 1088 ms 1792 KB Time limit exceeded
4 Halted 0 ms 0 KB -