제출 #332535

#제출 시각아이디문제언어결과실행 시간메모리
332535dolphingarlicApril Fools (LMIO17_faktai)C++14
100 / 100
354 ms492 KiB
#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;
}

컴파일 시 표준 에러 (stderr) 메시지

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);
      |             ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...