Submission #1332572

#TimeUsernameProblemLanguageResultExecution timeMemory
1332572islam_2010Stove (JOI18_stove)C++20
Compilation error
0 ms0 KiB
#pragma GCC optimize("O3")
#pragma GCC target("avx2,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
using namespace std;

const int sz = 2e5+5;

int pref[sz];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    vector<int> b(n-1);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }for(int i = 0; i < n-1; i++){
        b[i] = a[i+1]-a[i];
    }sort(b.begin(), b.end());
    int ans = m;
    for(int i = 0; i <= n-m; i++){
        ans += b[i];
    }cout << ans;
    
}

Compilation message (stderr)

In file included from /usr/include/c++/13/string:43,
                 from /usr/include/c++/13/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52,
                 from stove.cpp:3:
/usr/include/c++/13/bits/allocator.h: In destructor 'constexpr std::_Vector_base<int, std::allocator<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 = int]': target specific option mismatch
  184 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/13/vector:66,
                 from /usr/include/c++/13/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53:
/usr/include/c++/13/bits/stl_vector.h:133:14: note: called from here
  133 |       struct _Vector_impl
      |              ^~~~~~~~~~~~