답안 #689893

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
689893 2023-01-29T17:06:04 Z divad Norela (info1cup18_norela) C++14
0 / 100
16 ms 324 KB
#include <bits/stdc++.h>
#define int long long
#define NMAX 62
#define MMAX 26
using namespace std;
int n,m,q,x,ans;
bitset<NMAX> b[MMAX];

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> m;
    ans = -1;
    for(int i = 1; i <= m; i++){
        cin >> q;
        for(int j = 1; j <= q; j++){
            cin >> x;
            b[i][x] = 1;
        }
    }
    for(int i = 0; i < (1<<m); i++){
        bitset<NMAX> all;
        for(int j = 0; j < m; j++){
            if(i&(1<<j)){
                all ^= b[j+1];
            }
        }
        if(all.count() == n){
            if(ans == -1){
                ans = i;
            }else{
                if(__builtin_popcount(ans) > __builtin_popcount(i)){
                    ans = i;
                }
            }
        }
    }
    cout << __builtin_popcount(ans) << "\n";
    for(int j = 0; j < m; j++){
        if(ans&(1<<j)){
            cout << j+1 << " ";
        }
    }
    return 0;
}

Compilation message

norela.cpp: In function 'int main()':
norela.cpp:29:24: warning: comparison of integer expressions of different signedness: 'std::size_t' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   29 |         if(all.count() == n){
      |            ~~~~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 212 KB Output is correct
2 Correct 15 ms 324 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 16 ms 320 KB Output is correct
5 Correct 14 ms 324 KB Output is correct
6 Incorrect 15 ms 324 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 212 KB Output is correct
2 Correct 15 ms 324 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 16 ms 320 KB Output is correct
5 Correct 14 ms 324 KB Output is correct
6 Incorrect 15 ms 324 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 212 KB Output is correct
2 Correct 15 ms 324 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 16 ms 320 KB Output is correct
5 Correct 14 ms 324 KB Output is correct
6 Incorrect 15 ms 324 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 212 KB Output is correct
2 Correct 15 ms 324 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 16 ms 320 KB Output is correct
5 Correct 14 ms 324 KB Output is correct
6 Incorrect 15 ms 324 KB Output isn't correct
7 Halted 0 ms 0 KB -