Submission #976588

# Submission time Handle Problem Language Result Execution time Memory
976588 2024-05-06T19:12:21 Z marinaluca Rice Hub (IOI11_ricehub) C++14
100 / 100
14 ms 2904 KB
#include <bits/stdc++.h>

#pragma GCC optimize ("O4")
#pragma GCC optimize ("fast-math")
#pragma GCC optimize ("unroll-loops")

using namespace std;
//#define int long long
#define ll long long
#define xx first
#define yy second
#define all (x) begin(x), end(x)
#define FOR(i, a, b) for (auto i = (a); i < (b); ++ i)

int besthub (int R, int L, int X[], ll B){
    ll sum = 0;
    int maxi = 1;
    for (int st = 0, dr = 0; dr < R; ++ dr){
        sum += X[dr] - X[(st + dr) >> 1];
        while (sum > B){
            sum -= (X[(st + dr + 1) >> 1] - X[st ++]);
        }
        maxi = max (maxi, dr - st + 1);
    }
    return maxi;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:21:50: warning: operation on 'st' may be undefined [-Wsequence-point]
   21 |             sum -= (X[(st + dr + 1) >> 1] - X[st ++]);
      |                                               ~~~^~
ricehub.cpp:21:50: warning: operation on 'st' may be undefined [-Wsequence-point]
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 600 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 0 ms 600 KB Output is correct
15 Correct 1 ms 360 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 468 KB Output is correct
3 Correct 9 ms 2652 KB Output is correct
4 Correct 14 ms 2652 KB Output is correct
5 Correct 4 ms 2648 KB Output is correct
6 Correct 4 ms 2648 KB Output is correct
7 Correct 8 ms 2652 KB Output is correct
8 Correct 8 ms 2676 KB Output is correct
9 Correct 4 ms 2652 KB Output is correct
10 Correct 4 ms 2652 KB Output is correct
11 Correct 9 ms 2652 KB Output is correct
12 Correct 8 ms 2652 KB Output is correct
13 Correct 7 ms 2652 KB Output is correct
14 Correct 4 ms 2652 KB Output is correct
15 Correct 7 ms 2652 KB Output is correct
16 Correct 7 ms 2904 KB Output is correct
17 Correct 8 ms 2652 KB Output is correct
18 Correct 8 ms 2636 KB Output is correct
19 Correct 9 ms 2652 KB Output is correct
20 Correct 8 ms 2652 KB Output is correct