제출 #1316542

#제출 시각아이디문제언어결과실행 시간메모리
1316542pavfyiHacker (BOI15_hac)C++20
컴파일 에러
0 ms0 KiB
#include "bits/stdc++.h"
#include <print>
#include <bit>

using ll = long long;
using namespace std;

const int N = 1'000'007;
const int LEVELS = 20;
int max_strips[LEVELS][N];

int getMaxStrip(int l,int r){


    int level = bit_width((unsigned)(r-l+1))-1;
    int size = 1<<level;

    int k = r-size+1;
    return max(max_strips[level][k],max_strips[level][l]);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;
    vector<int> a(n);
    int total = 0;
    vector<int> strip_sums;
    
    for (int i = 0; i<n; i++){
        cin >>a[i]; 
        total+=a[i];
    }
    int k = n/2;
    int curr = 0;

    for (int i = 0; i < k; i++){
        curr+=a[i];
    }

    int l = 0, r = k-1;

    for (int i = 0; i < n; i++){
        strip_sums.push_back(curr);
        r = (r+1)%n;
        curr+=a[r];
        curr-=a[l];
        l = (l+1)%n;
    }
    
    for (int i = 0; i < n; i++){
        max_strips[0][i] = strip_sums[i];
    }

    for (int i = 1; i < LEVELS; i++){
        for (int j = 0; j+(1<<i) <= n; j++){
            max_strips[i][j] = max(max_strips[i-1][j], max_strips[i-1][j+(1<<(i-1))]);
        }
    }
    
    int smallest = INT_MAX;

    for (int i = 0; i < n; i++){
        int l = (i+1)%n;
        int r = (i+ceil((double)n/2));
        r%=n;
        
        if (l > r){
            smallest = min(smallest,max(getMaxStrip(0,r),20));
        }
        else{
            smallest = min(smallest,getMaxStrip(l,r));
        }
    }

    cout << total-smallest;
}

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

hac.cpp:2:10: fatal error: print: No such file or directory
    2 | #include <print>
      |          ^~~~~~~
compilation terminated.