Submission #1074948

#TimeUsernameProblemLanguageResultExecution timeMemory
1074948raduvNorela (info1cup18_norela)C++17
0 / 100
1041 ms344 KiB
#include <bits/stdc++.h> #define int long long const int MAXM = 24; const int MAXN = 60; using namespace std; long long v[MAXM]; signed 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] |= (1 << bit); } } mn = m + 1; cmask = 0; for( mask = 0; mask < (1 << m); mask++ ){ rez = 0; for( i = 0; i < m; i++ ){ if(mask & (1 << i)){ rez ^= v[i]; } } if(__builtin_popcount(rez) == n && __builtin_popcount(mask) < mn){ mn = __builtin_popcount(mask); 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:11:13: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
   11 |     scanf("%d%d", &n, &m);
      |            ~^     ~~
      |             |     |
      |             int*  long long int*
      |            %lld
norela.cpp:11:15: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'long long int*' [-Wformat=]
   11 |     scanf("%d%d", &n, &m);
      |              ~^       ~~
      |               |       |
      |               int*    long long int*
      |              %lld
norela.cpp:13:15: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
   13 |       scanf("%d", &q);
      |              ~^   ~~
      |               |   |
      |               |   long long int*
      |               int*
      |              %lld
norela.cpp:15:17: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
   15 |         scanf("%d", &bit);
      |                ~^   ~~~~
      |                 |   |
      |                 |   long long int*
      |                 int*
      |                %lld
norela.cpp:34:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
   34 |     printf("%d\n", mn);
      |             ~^     ~~
      |              |     |
      |              int   long long int
      |             %lld
norela.cpp:37:18: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
   37 |         printf("%d ", i + 1);
      |                 ~^    ~~~~~
      |                  |      |
      |                  int    long long int
      |                 %lld
norela.cpp:9:26: warning: unused variable 'no' [-Wunused-variable]
    9 |     int n, m, q, bit, i, no, mn, mask, cmask;
      |                          ^~
norela.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%d%d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~
norela.cpp:13:12: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |       scanf("%d", &q);
      |       ~~~~~^~~~~~~~~~
norela.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         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...