답안 #1075034

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1075034 2024-08-25T17:47:07 Z raduv Norela (info1cup18_norela) C++17
100 / 100
97 ms 600 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){
    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] |= (1LL << bit);
      }
    }
    bkt(0, 0LL);
    printf("%d\n", mn);
    for( auto x : ans )
      printf("%d ", x + 1);
    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 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 440 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 440 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 6 ms 348 KB Output is correct
8 Correct 12 ms 436 KB Output is correct
9 Correct 15 ms 440 KB Output is correct
10 Correct 12 ms 348 KB Output is correct
11 Correct 17 ms 600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 440 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 6 ms 348 KB Output is correct
8 Correct 12 ms 436 KB Output is correct
9 Correct 15 ms 440 KB Output is correct
10 Correct 12 ms 348 KB Output is correct
11 Correct 17 ms 600 KB Output is correct
12 Correct 12 ms 436 KB Output is correct
13 Correct 24 ms 348 KB Output is correct
14 Correct 25 ms 348 KB Output is correct
15 Correct 24 ms 348 KB Output is correct
16 Correct 24 ms 348 KB Output is correct
17 Correct 24 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 440 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 6 ms 348 KB Output is correct
8 Correct 12 ms 436 KB Output is correct
9 Correct 15 ms 440 KB Output is correct
10 Correct 12 ms 348 KB Output is correct
11 Correct 17 ms 600 KB Output is correct
12 Correct 12 ms 436 KB Output is correct
13 Correct 24 ms 348 KB Output is correct
14 Correct 25 ms 348 KB Output is correct
15 Correct 24 ms 348 KB Output is correct
16 Correct 24 ms 348 KB Output is correct
17 Correct 24 ms 348 KB Output is correct
18 Correct 48 ms 352 KB Output is correct
19 Correct 49 ms 356 KB Output is correct
20 Correct 96 ms 348 KB Output is correct
21 Correct 95 ms 348 KB Output is correct
22 Correct 95 ms 344 KB Output is correct
23 Correct 97 ms 416 KB Output is correct