답안 #332535

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
332535 2020-12-02T19:52:25 Z dolphingarlic April Fools (LMIO17_faktai) C++14
100 / 100
354 ms 492 KB
#include <bits/stdc++.h>
using namespace std;

bitset<200> bs[20];

int main() {
    int n, m;
    scanf("%d %d", &n, &m);
    for (int i = 0; i < n; i++) {
        int k;
        scanf("%d", &k);
        for (int j = 0; j < k; j++) {
            int f;
            scanf("%d", &f);
            bs[f - 1][i] = 1;
        }
    }

    int lb = n, ub = 0;
    for (int mask = 0; mask < (1 << m); mask++) {
        bitset<200> cov;
        bool good = true;
        for (int i = 0; i < m; i++) if (mask & (1 << i)) {
            if ((cov & bs[i]).count()) {
                good = false;
                break;
            }
            cov |= bs[i];
        }
        if (good && cov.count() == n) {
            lb = min(lb, __builtin_popcount(mask));
            ub = max(ub, __builtin_popcount(mask));
        }
    }
    printf("%d %d", lb, ub);
    return 0;
}

Compilation message

faktai.cpp: In function 'int main()':
faktai.cpp:30:33: warning: comparison of integer expressions of different signedness: 'std::size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   30 |         if (good && cov.count() == n) {
      |                     ~~~~~~~~~~~~^~~~
faktai.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    8 |     scanf("%d %d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~~
faktai.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   11 |         scanf("%d", &k);
      |         ~~~~~^~~~~~~~~~
faktai.cpp:14:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   14 |             scanf("%d", &f);
      |             ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 67 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 96 ms 364 KB Output is correct
5 Correct 75 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 354 ms 492 KB Output is correct
2 Correct 127 ms 492 KB Output is correct
3 Correct 97 ms 492 KB Output is correct
4 Correct 85 ms 364 KB Output is correct
5 Correct 97 ms 364 KB Output is correct
6 Correct 111 ms 492 KB Output is correct
7 Correct 94 ms 492 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 67 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 96 ms 364 KB Output is correct
12 Correct 75 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct