답안 #1075033

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1075033 2024-08-25T17:46:20 Z raduv Norela (info1cup18_norela) C++17
0 / 100
14 ms 432 KB
#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

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))
      |          ~~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 348 KB Output is correct
2 Correct 14 ms 432 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 12 ms 348 KB Output is correct
5 Correct 14 ms 348 KB Output is correct
6 Incorrect 13 ms 344 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 348 KB Output is correct
2 Correct 14 ms 432 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 12 ms 348 KB Output is correct
5 Correct 14 ms 348 KB Output is correct
6 Incorrect 13 ms 344 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 348 KB Output is correct
2 Correct 14 ms 432 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 12 ms 348 KB Output is correct
5 Correct 14 ms 348 KB Output is correct
6 Incorrect 13 ms 344 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 348 KB Output is correct
2 Correct 14 ms 432 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 12 ms 348 KB Output is correct
5 Correct 14 ms 348 KB Output is correct
6 Incorrect 13 ms 344 KB Output isn't correct
7 Halted 0 ms 0 KB -