Submission #1316690

#TimeUsernameProblemLanguageResultExecution timeMemory
1316690jahongirChorus (JOI23_chorus)C++20
Compilation error
0 ms0 KiB
#pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #pragma GCC target("popcnt") #include <bits/stdc++.h> using namespace std; #define pb push_back #define all(a) a.begin(),a.end() typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef unsigned long long ull; typedef vector<int> vi; int dp[1001][501]; vector<int> A(1,0), B(1,0); int Cost(int j, int i){ int len = i-j, res = 0; for(int l = 1; l <= len/2; l++){ res += max(0,A[l+j/2] - j-l); } return res; } void solve(){ int n,k; cin >> n >> k; for(int i = 1; i <= 2*n; i++){ char c; cin >> c; (c=='A'?A:B).emplace_back(i); } for(int i = 2; i <= 2*n; i+=2){ fill(dp[i],dp[i]+k+1,1e9); for(int j = 0; j < i; j+=2){ int c = Cost(j,i); for(int l = 1; l <= k; l++) dp[i][l] = min(dp[i][l],dp[j][l-1]+c); } } int ans = 1e9; for(int j = 1; j <= k; j++) ans = min(ans,dp[2*n][j]); cout << ans; } signed main(){ cin.tie(0)->sync_with_stdio(0); int t = 1; // cin >> t; while(t--){solve();} }

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 chorus.cpp:5:
/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
      |              ^~~~~~~~~~~~