Submission #1012090

#TimeUsernameProblemLanguageResultExecution timeMemory
1012090codefoxLongest beautiful sequence (IZhO17_subsequence)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define pii pair<int, int> #define pipii pair<int, pii> #pragma GCC optimize("Ofast") #pragma GCC target("popcnt") int N = 1<<20; int main() { //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); int n; cin >> n; vector<int> a(n); vector<int> k(n); for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) cin >> k[i]; vector<pii> best(n); for (int i = 0; i < n; i++) { best[i] = {1, -1}; for (int j = 0; j < i; j++) { if (__popcount(a[j]&a[i])==k[i]) { if (best[i].first<best[j].first+1) { best[i] = {best[j].first+1, j}; } } } } int mx = 0; int nn = 0; for (int i = 0; i < n; i++) { if (best[i].first>mx) { mx = best[i].first; nn = i; } } cout << mx << "\n"; vector<int> sol; while (nn != -1) { sol.push_back(nn); nn = best[nn].second; } reverse(sol.begin(), sol.end()); for (int ele:sol) cout << ele+1 << " "; return 0; }

Compilation message (stderr)

subsequence.cpp: In function 'int main()':
subsequence.cpp:34:17: error: '__popcount' was not declared in this scope
   34 |             if (__popcount(a[j]&a[i])==k[i])
      |                 ^~~~~~~~~~