제출 #976590

#제출 시각아이디문제언어결과실행 시간메모리
976590marinaluca쌀 창고 (IOI11_ricehub)C++14
100 / 100
9 ms2676 KiB
#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;
}

컴파일 시 표준 에러 (stderr) 메시지

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...