Submission #363879

#TimeUsernameProblemLanguageResultExecution timeMemory
363879ogibogi2004Norela (info1cup18_norela)C++14
0 / 100
9 ms364 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long ll n,m; vector<ll>spells; vector<ll>used; vector<ll>ans; ll xr=0; void rec(int idx) { //cout<<idx<<" "<<xr<<endl; if(used.size()>ans.size())return; if(idx>spells.size()) { if(xr==(1<<n)-1) { if(used.size()<ans.size())ans=used; } return; } else { rec(idx+1); used.push_back(idx); xr^=spells[idx]; rec(idx+1); used.pop_back(); xr^=spells[idx]; } } int main() { cin>>n>>m; for(int i=0;i<m;i++) { ll cnt; cin>>cnt; ll mask=0; for(ll j=0;j<cnt;j++) { ll x; cin>>x;mask|=(1<<(x-1)); } spells.push_back(mask); } /*for(int i=0;i<m;i++) { cout<<spells[i]<<endl; }*/ for(int i=0;i<m+2;i++) { ans.push_back(m+3); } rec(0); cout<<ans.size()<<endl; for(auto xd:ans) { cout<<xd+1<<" "; } cout<<endl; return 0; }

Compilation message (stderr)

norela.cpp: In function 'void rec(int)':
norela.cpp:13:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |  if(idx>spells.size())
      |     ~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...