Submission #1075033

#TimeUsernameProblemLanguageResultExecution timeMemory
1075033raduvNorela (info1cup18_norela)C++17
0 / 100
14 ms432 KiB
#include <bits/stdc++.h> const int MAXM = 26; using namespace std; long long v[MAXM]; int main() { int n, m, q, bit, i, no, mn, mask, cmask; long long rez; scanf("%d%d", &n, &m); for( i = 0; i < m; i++ ){ scanf("%d", &q); while(q--){ scanf("%d", &bit); bit--; v[i] |= (1LL << bit); } } mn = m + 1; for( mask = 0; mask < (1 << m); mask++ ){ rez = no = 0; for( i = 0; i < m; i++ ){ if(mask & (1 << i)){ rez ^= v[i]; no++; } } if(rez == (1LL << n) - 1 && no < mn){ mn = no; cmask = mask; } } printf("%d\n", mn); for( i = 0; i < m; i++ ){ if(cmask & (1 << i)) printf("%d ", i + 1); } return 0; }

Compilation message (stderr)

norela.cpp: In function 'int main()':
norela.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d%d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~
norela.cpp:11:12: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |       scanf("%d", &q);
      |       ~~~~~^~~~~~~~~~
norela.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         scanf("%d", &bit);
      |         ~~~~~^~~~~~~~~~~~
norela.cpp:34:16: warning: 'cmask' may be used uninitialized in this function [-Wmaybe-uninitialized]
   34 |       if(cmask & (1 << 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...