Submission #1269097

#TimeUsernameProblemLanguageResultExecution timeMemory
1269097tryharderforioi100Longest beautiful sequence (IZhO17_subsequence)C11
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<int> a(n), b(n); for (int i=0;i<n;i++) cin >> a[i]; for (int i=0;i<n;i++) cin >> b[i]; vector<int> dp(n, 1), parent(n, -1); vector<int> best(33, 0), bestIdx(33, -1); int ans = 1, last = 0; for (int i=0;i<n;i++) { dp[i] = best[b[i]] + 1; if (bestIdx[b[i]] != -1) parent[i] = bestIdx[b[i]]; if (dp[i] > best[__builtin_popcount(a[i])]) { best[__builtin_popcount(a[i])] = dp[i]; bestIdx[__builtin_popcount(a[i])] = i; } if (dp[i] > ans) { ans = dp[i]; last = i; } } cout << ans << "\n"; vector<int> seq; for (int x = last; x != -1; x = parent[x]) seq.push_back(x+1); reverse(seq.begin(), seq.end()); for (int x: seq) cout << x << " "; cout << "\n"; }

Compilation message (stderr)

subsequence.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.