제출 #1289573

#제출 시각아이디문제언어결과실행 시간메모리
1289573opituNorela (info1cup18_norela)C++20
75 / 100
1051 ms580 KiB
#pragma GCC target("tune=native") #pragma GCC optimize("Ofast,inline") #include <bits/stdc++.h> #define int long long #define POP __builtin_popcount #define iamaperson int main() {\ preprocess();\ int t = 1; while (t--) solve();\ } using namespace std; void preprocess() {} // just in case!!!!1 void solve() { int n, m; cin >> n >> m; vector<int> mgc(m); for (int i = 0; i < m; ++i) { int q; cin >> q; for (int _ = 0; _ < q; ++_) { int x; cin >> x; mgc[i] |= 1LL<<(x-1); } } vector<int> pot; for (int i = 0; i < 1LL<<m; ++i) { int x = 0; for (int j = 0; j < m; ++j) if (i&(1<<(m-1-j))) { x ^= mgc[j]; } if (x == (1LL<<n)-1) { if (!pot.size() || POP(pot.back()) == POP(i)) pot.push_back(i); else if (POP(pot.back()) > POP(i)) pot = vector{i}; } } int ans = *max_element(pot.begin(), pot.end()); cout << POP(ans) << '\n'; for (int j = 0; j < m; ++j) if (ans&(1<<(m-1-j))) cout << 1+j << ' '; } #undef int iamaperson
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...