Submission #1075025

#TimeUsernameProblemLanguageResultExecution timeMemory
1075025raduvNorela (info1cup18_norela)C++17
0 / 100
2 ms348 KiB
#include <bits/stdc++.h> const int MAXM = 250; using namespace std; long long v[MAXM]; vector<int> ans, aux; int mn = -1, n, m; void bkt(int poz, long long mask){ if(poz == m){ if(mask == (1LL << n) - 1 && (aux.size() <= mn || mn == -1)){ mn = aux.size(); ans = aux; } } else{ bkt(poz + 1, mask); aux.push_back(poz); bkt(poz + 1, mask ^ v[poz]); aux.pop_back(); } } int main() { int q, bit, i; 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] |= (1 << bit); } } bkt(0, 0LL); printf("%d\n", mn); for( auto x : ans ) printf("%d ", x + 1); printf("\n"); return 0; }

Compilation message (stderr)

norela.cpp: In function 'void bkt(int, long long int)':
norela.cpp:9:46: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
    9 |     if(mask == (1LL << n) - 1 && (aux.size() <= mn || mn == -1)){
      |                                   ~~~~~~~~~~~^~~~~
norela.cpp: In function 'int main()':
norela.cpp:24:15: warning: unused variable 'rez' [-Wunused-variable]
   24 |     long long rez;
      |               ^~~
norela.cpp:25:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |     scanf("%d%d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~
norela.cpp:27:12: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |       scanf("%d", &q);
      |       ~~~~~^~~~~~~~~~
norela.cpp:29:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |         scanf("%d", &bit);
      |         ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...