Submission #1269048

#TimeUsernameProblemLanguageResultExecution timeMemory
1269048raymoo_Longest beautiful sequence (IZhO17_subsequence)C++17
Compilation error
0 ms0 KiB
#pragma GCC target("popcnt") #include<bits/stdc++.h> using namespace std; #define ll long long #define fi first #define se second #define ldb long double #define pii pair<int, int> #define bend(v) v.begin(), v.end() const int N = 2e5 + 5, M = 1e6 + 5; const int mod = 1e9 + 7; const int base = 311; const int inf = INT_MAX; const ll INF = LLONG_MAX; int n, a[N], k[N]; pii dp[N]; vector<int> d[25]; void solve(){ cin>>n; for(int i = 1; i <= n; i++) cin>>a[i]; for(int i = 1; i <= n; i++) cin>>k[i]; pii ans = {0, 0}; for(int i = 1; i <= n; i++){ dp[i] = {1, i}; int cb = __builtin_popcount(a[i]); // if(cb < k[i]) continue; for(int v = k[i]; v <= 20; v++){ for(int j : d[v]){ if(__builtin_popcount(a[i] & a[j]) == k[i]){ dp[i] = max(dp[i], {dp[j].fi + 1, j}); } } } ans = max(ans, {dp[i].fi, i}); d[cb].push_back(i); } // for(int i = 1; i <= n; i++) cout<<"!!! "<<dp[i].fi<<" "<<dp[i].se<<'\n'; cout<<ans.fi<<'\n'; vector<int> idk; int cur = ans.se; while(dp[cur].se != cur){ idk.push_back(cur); cur = dp[cur].se; } idk.push_back(cur); reverse(idk.begin(), idk.end()); for(int x : idk) cout<<x<<" "; } signed main(){ // freopen(".inp", "r", stdin); // freopen(".out", "w", stdout); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int tc = 1; // cin>>tc; while(tc--) 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 subsequence.cpp:3:
/usr/include/c++/13/bits/allocator.h: In destructor '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' '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
      |              ^~~~~~~~~~~~