답안 #228283

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
228283 2020-04-30T11:46:54 Z filiptudose7 Norela (info1cup18_norela) C++11
0 / 100
6 ms 384 KB
#include <bits/stdc++.h>
using namespace std;

int sol,nrsol=INT_MAX,n,m;
long long vr[30];

void bec(long long mcarti, int act, int mvraji, int nrvraja)
{
    if(act==m)
    {
        if(mcarti==(1<<n)-1)
        {
            if(nrsol>nrvraja)
            {
                nrsol=nrvraja;
                sol=mvraji;
            }
        }
        return ;
    }
    bec(mcarti^vr[act],act+1,mvraji^(1<<act),nrvraja+1);
    bec(mcarti,act+1,mvraji,nrvraja);
}
int main()
{
    freopen("norela.in","r",stdin);
    freopen("norela.out","w",stdout);
    cin.sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>m;
    for(int i=0; i<m; ++i)
    {
        int q;
        cin>>q;
        for(int j=0; j<q; ++j)
        {
            int x;
            cin>>x;
            x--;
            vr[i]^=(1LL<<(x));
        }
    }
    bec(0,0,0,0);
    cout<<nrsol<<'\n';
    for(int i=0; i<=m-1; ++i)if(sol&(1<<i))cout<<i+1<<" ";
    cout<<'\n';
    return 0;
}

Compilation message

norela.cpp: In function 'int main()':
norela.cpp:26:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("norela.in","r",stdin);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
norela.cpp:27:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("norela.out","w",stdout);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -