답안 #1075017

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1075017 2024-08-25T17:38:11 Z raduv Norela (info1cup18_norela) C++17
0 / 100
3 ms 348 KB
#include <bits/stdc++.h>
const int MAXM = 24;
using namespace std;
long long v[MAXM];
vector<int> ans, aux;
int mn = 1e9, n, m;
void bkt(int poz, long long mask){
  if(poz == m){
    if(mask == (1LL << n) - 1 && (aux.size() <= mn)){
      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, no, 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);
      }
    }
    bkt(0, 0LL);
    printf("%d\n", mn);
    for( auto x : ans )
      printf("%d ", x + 1);
    return 0;
}

Compilation message

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)){
      |                                   ~~~~~~~~~~~^~~~~
norela.cpp: In function 'int main()':
norela.cpp:23:20: warning: unused variable 'no' [-Wunused-variable]
   23 |     int q, bit, i, no, mask, cmask;
      |                    ^~
norela.cpp:23:24: warning: unused variable 'mask' [-Wunused-variable]
   23 |     int q, bit, i, no, mask, cmask;
      |                        ^~~~
norela.cpp:23:30: warning: unused variable 'cmask' [-Wunused-variable]
   23 |     int q, bit, i, no, mask, cmask;
      |                              ^~~~~
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);
      |         ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Incorrect 3 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Incorrect 3 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Incorrect 3 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Incorrect 3 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -