Submission #248994

#TimeUsernameProblemLanguageResultExecution timeMemory
248994blacktulipNorela (info1cup18_norela)C++17
20 / 100
1084 ms368 KiB
#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)

norela.cpp: In function 'int main()':
norela.cpp:59:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d",&n,&m);
  ~~~~~^~~~~~~~~~~~~~~
norela.cpp:62:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&l[i]);
   ~~~~~^~~~~~~~~~~~
norela.cpp:63:32: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   for(int j=1;j<=l[i];j++)scanf("%d",&a[i][j]);
                           ~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...