제출 #1336088

#제출 시각아이디문제언어결과실행 시간메모리
1336088yhkhooHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++17
컴파일 에러
0 ms0 KiB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

#include <bits/stdc++.h>
using namespace std;

const int INF = 2e9;

signed main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n, q;
    cin >> n >> q;
    int w[n], mi[18][n], ma[18][n];
    memset(mi, INF, sizeof(mi));
    memset(ma, 0, sizeof(ma));
    for(int i=0; i<n; i++){
        cin >> w[i];
        mi[0][i] = w[i];
    }
    for(int k=1; k<18; k++){
        for(int i=0; i<n-(1<<(k-1)); i++){
            mi[k][i] = min(mi[k-1][i], mi[k-1][i+(1<<(k-1))]);
            ma[k][i] = max(ma[k-1][i], ma[k-1][i+(1<<(k-1))]);
        }
    }
    for(int i=0; i<q; i++){
        int l, r, m;
        cin >> l >> r >> m;
        l--; r--;
        int ma = -1;
        bool ans = 1;
        for(int j=l; j<=r; j++){
            if(w[j] < ma){
                if(w[j] + ma > m){
                    ans = 0;
                    break;
                }
            }
            else{
                ma = w[j];
                int k = bit_floor((unsigned)j);
                int mg = min(mi[k][j], mi[k][r - (1<<k) + 1]);
                if(mg < w[j] && mg + w[j] > m){
                    ans = 0;
                    break;
                }
            }
        }
        cout << ans << '\n';
    }
    return 0;
}

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

sortbooks.cpp: In function 'int main()':
sortbooks.cpp:41:25: error: 'bit_floor' was not declared in this scope
   41 |                 int k = bit_floor((unsigned)j);
      |                         ^~~~~~~~~