답안 #976590

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
976590 2024-05-06T19:13:03 Z marinaluca 쌀 창고 (IOI11_ricehub) C++14
100 / 100
9 ms 2676 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]
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 356 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 344 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 0 ms 348 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 448 KB Output is correct
23 Correct 1 ms 344 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 344 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 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 1 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 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 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 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 344 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
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 8 ms 2652 KB Output is correct
4 Correct 9 ms 2652 KB Output is correct
5 Correct 4 ms 2676 KB Output is correct
6 Correct 4 ms 2652 KB Output is correct
7 Correct 7 ms 2652 KB Output is correct
8 Correct 8 ms 2648 KB Output is correct
9 Correct 4 ms 2636 KB Output is correct
10 Correct 4 ms 2652 KB Output is correct
11 Correct 9 ms 2640 KB Output is correct
12 Correct 8 ms 2648 KB Output is correct
13 Correct 4 ms 2652 KB Output is correct
14 Correct 4 ms 2652 KB Output is correct
15 Correct 6 ms 2652 KB Output is correct
16 Correct 6 ms 2652 KB Output is correct
17 Correct 7 ms 2652 KB Output is correct
18 Correct 9 ms 2652 KB Output is correct
19 Correct 8 ms 2648 KB Output is correct
20 Correct 8 ms 2652 KB Output is correct