# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
70426 | 2018-08-22T21:02:56 Z | MrTEK | Norela (info1cup18_norela) | C++14 | 6 ms | 556 KB |
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back #define len(a) (int)a.size() #define fi first #define sc second #define d1(w) cerr<<#w<<":"<<w<<endl; #define d2(w,c) cerr<<#w<<":"<<w<<" "<<#c<<":"<<c<<endl; #define d3(w,c,z) cerr<<#w<<":"<<w<<" "<<#c<<":"<<c<<" "<<#z<<":"<<z<<endl; #define left isc+isc #define right isc+isc+1 #define mid (l+r)/2 #define FAfi_IO ios_base::sync_with_fidio(false); #define escl '\n' #define bit __builtin_popcount typedef long long int ll; const int maxn = 620; const long long LINF = 1e18; const int LOG = 31; const int INF = 1e9; const int N = 65; const int M = 26; const int SQ = 350; const int MOD = 998244353; typedef long long int lli; typedef pair<int,int> pii; vector <int> v[N]; int n,m; ll tar,ans,a[N]; int my_min(int x,int y) { if (bit(x) < bit(y)) return x; if (bit(x) > bit(y)) return y; for (int i = 0 ; i < m ; i++) { int a = x & (1 << i) , b = y & (1 << i); if (a > b) return x; if (a < b) return y; } return x; } void brute(int cur,ll mask,int sum) { if (mask == tar) { ans = my_min(ans,sum); return; } if (cur == m) return ; brute(cur + 1,mask,sum); brute(cur + 1,mask ^ a[cur], sum + (1 << cur)); } int main() { scanf("%d %d",&n,&m); tar = (1ll << n) - 1; ans = (1ll << m) - 1; for (int i = 0 ; i < m ; i++) { int q; scanf("%d",&q); for (int j = 1 ; j <= q ; j++) { int x; scanf("%d",&x); a[i] = a[i] ^ (1 << (x - 1)); } } brute(0,0,0); printf("%d\n",bit(ans)); for (int i = 0 ; i < m ; i++) { if ((1 << i) & ans) printf("%d ",i + 1); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 504 KB | Output is correct |
2 | Incorrect | 6 ms | 556 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 504 KB | Output is correct |
2 | Incorrect | 6 ms | 556 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 504 KB | Output is correct |
2 | Incorrect | 6 ms | 556 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 504 KB | Output is correct |
2 | Incorrect | 6 ms | 556 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |