답안 #1075028

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1075028 2024-08-25T17:43:28 Z raduv Norela (info1cup18_norela) C++17
0 / 100
2 ms 348 KB
#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 + 1){
    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 = 1; i <= m; i++ ){
      scanf("%d", &q);
      while(q--){
        scanf("%d", &bit);
        bit--;
        v[i] |= (1 << bit);
      }
    }
    bkt(1, 0LL);
    printf("%d\n", mn);
    for( auto x : ans )
      printf("%d ", x);
    printf("\n");
    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 || 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);
      |         ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Incorrect 2 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 2 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 2 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 2 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -