# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
363876 | 2021-02-07T12:40:10 Z | ogibogi2004 | Norela (info1cup18_norela) | C++14 | 9 ms | 384 KB |
#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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Incorrect | 9 ms | 372 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Incorrect | 9 ms | 372 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Incorrect | 9 ms | 372 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Incorrect | 9 ms | 372 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |