제출 #1012095

#제출 시각아이디문제언어결과실행 시간메모리
1012095codefoxLongest beautiful sequence (IZhO17_subsequence)C++14
0 / 100
0 ms348 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<bitset<20>> 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 ((a[j]&a[i]).count()==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; }

컴파일 시 표준 에러 (stderr) 메시지

subsequence.cpp: In function 'int main()':
subsequence.cpp:34:36: warning: comparison of integer expressions of different signedness: 'std::size_t' {aka 'long unsigned int'} and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} [-Wsign-compare]
   34 |             if ((a[j]&a[i]).count()==k[i])
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...