# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
248995 | blacktulip | Norela (info1cup18_norela) | C++17 | 1089 ms | 384 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long lo;
typedef pair< lo,lo > PII;
#define fi first
#define se second
#define mp make_pair
#define endl "\n"
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)
const lo inf = 1000000000000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 65;
const lo mod = 1000000007;
int n,m,b[li],a[li][li],k,flag,t,no[li],l[li];
int cev;
string s;
vector<int> mini;
inline void f(int sira,int mask){
if(sira>m){
for(int i=1;i<=n;i++)no[i]=0;
for(int i=0;i<m;i++){
if((mask&(1<<i))==0)continue;
for(int j=1;j<=l[i];j++){
no[a[i][j]]++;
}
}
flag=0;
FOR{
if(no[i]%2==0)flag=1;
}
vector<int> v;
if(flag==1)return ;
for(int i=0;i<m;i++){
if((mask&(1<<i))==0)continue;
v.pb(i+1);
}
//~ sort(v.begin(),v.end());
if((int)v.size()<(int)mini.size()){swap(mini,v);return ;}
if((int)v.size()>(int)mini.size()){return ;}
if(mini>v)swap(mini,v);
return ;
}
f(sira+1,mask);
f(sira+1,(mask|(1<<sira)));
}
int main(void){
scanf("%d %d",&n,&m);
for(int i=1;i<=m;i++)mini.pb(1000000);
for(int i=0;i<m;i++){
scanf("%d",&l[i]);
for(int j=1;j<=l[i];j++)scanf("%d",&a[i][j]);
}
f(0,0);
printf("%d\n",(int)mini.size());
for(int i=0;i<(int)mini.size();i++){
printf("%d ",mini[i]);
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |