(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #898163

#TimeUsernameProblemLanguageResultExecution timeMemory
898163AI_2512Longest beautiful sequence (IZhO17_subsequence)C++17
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> using namespace std; signed main(){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); int n; cin >> n; vector<int> a(n); vector<int> k(n); vector<int> res; vector<int> ne; ne.push_back(1); for (int i = 0; i< n;i++) cin >> a[i]; for (int i = 0; i< n;i++) cin >> k[i]; for (int i = 1; i< n;i++){ int c = a[i-1]; int b = a[i]; int pop = __builtin_popcount(c&b); if (pop == k[i]){ ne.push_back(i+1); }else{ if (ne.size()>res.size()){ res = ne; ne.clear(); } } } if (ne.size()>res.size()){ res = ne; } ne.clear(); for (int i = 1; i< n;i++){ int c = a[i-1]; int b = a[i]; int pop = __builtin_popcount(c&b); if (pop == k[i]){ ne.push_back(i+1); } } if (ne.size()>res.size()){ res = ne; ne.clear(); } cout << res.size() << "\n"; for (int el:res) cout << el << " "; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...