답안 #486032

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
486032 2021-11-10T10:52:57 Z sam571128 Norela (info1cup18_norela) C++17
0 / 100
15 ms 332 KB
#include <bits/stdc++.h>

#define int long long
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

signed main(){
    fastio
    int n,m;
    cin >> n >> m;
    
    vector<int> v(m);
    for(int i = 0;i < m;i++){
        int q;
        cin >> q;
        int tmp = 0;
        for(int j = 0;j < q;j++){
            int x;
            cin >> x;
            x--;
            tmp ^= (1LL<<x);
        }
        v[i] = tmp;
    }

    int ans = (1LL<<61)-1;
    for(int i = 0;i < (1<<m);i++){
        int now = (1LL<<n)-1;
        for(int j = 0;j < m;j++){
            if(i&(1LL<<j)){
                now ^= v[j];
            }
        }

        if(now==0){
            if(__builtin_popcountll(ans) >= __builtin_popcountll(i)) ans = i;
        }
    }

    cout << __builtin_popcountll(ans) << "\n";    
    for(int j = 0;j < m;j++){
        if(ans&(1LL<<j)){
            cout << j+1 << " ";
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 204 KB Output is correct
2 Correct 15 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Incorrect 15 ms 332 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 204 KB Output is correct
2 Correct 15 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Incorrect 15 ms 332 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 204 KB Output is correct
2 Correct 15 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Incorrect 15 ms 332 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 204 KB Output is correct
2 Correct 15 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Incorrect 15 ms 332 KB Output isn't correct
5 Halted 0 ms 0 KB -