제출 #1343173

#제출 시각아이디문제언어결과실행 시간메모리
1343173hyyhGroup Photo (JOI21_ho_t3)C++20
컴파일 에러
0 ms0 KiB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <iostream>
#include <math.h>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <cstring>
#include <iomanip>
#include <set>
#include <bitset>
#include <bit>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using piii = tuple<int,int,int>;
#define endl '\n'
#define f first
#define s second

int const N = 5e3+10;

int INF = 1e9+10;

int dp[N];

int vc[N];

int fenwick[N];

int si;

void update(int n, int val){
    for(;n <= si;n += n&-n) fenwick[n] += val;
}

int sum(int n){
    int ans = 0;
    for(;n > 0;n -= n&-n) ans += fenwick[n];
    return ans;
}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;cin >> n;
    si = n;
    for(int i{};i < n;i++){
        cin >> vc[i];
    }
    dp[2] = 0;
    for(int t{3};t <= n;t++){
        dp[t] = INF;
        vector<pii> pos(t+1);
        int i = 0;
        for(int j{};j < n;j++){
            if(vc[j] <= t){
                pos[vc[j]] = {j,i};
                i++;
            }
        }
        for(int i{t};i >= 1;i--){
            int cnt = 0;
            memset(fenwick,0,sizeof fenwick);
            for(int j{i};j <= t;j++){
                int val = t-pos[j].s;
                cnt += val-1;
                cnt -= sum(val);
                update(val,1);
            }
            dp[t] = min(dp[t],dp[i-1]+cnt);
        }
    }
    cout << dp[n];
}

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

In file included from /usr/include/c++/13/string:43,
                 from /usr/include/c++/13/bits/locale_classes.h:40,
                 from /usr/include/c++/13/bits/ios_base.h:41,
                 from /usr/include/c++/13/ios:44,
                 from /usr/include/c++/13/ostream:40,
                 from /usr/include/c++/13/iostream:41,
                 from Main.cpp:3:
/usr/include/c++/13/bits/allocator.h: In destructor 'constexpr std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int> > >::_Vector_impl::~_Vector_impl()':
/usr/include/c++/13/bits/allocator.h:184:7: error: inlining failed in call to 'always_inline' 'constexpr std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = std::pair<int, int>]': target specific option mismatch
  184 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/13/vector:66,
                 from Main.cpp:5:
/usr/include/c++/13/bits/stl_vector.h:133:14: note: called from here
  133 |       struct _Vector_impl
      |              ^~~~~~~~~~~~