Submission #1062145

# Submission time Handle Problem Language Result Execution time Memory
1062145 2024-08-16T19:47:26 Z pera Norela (info1cup18_norela) C++17
0 / 100
9 ms 6848 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
   int n , m;
   cin >> n >> m;
   long long M = (1LL << n) - 1;
   vector<long long> v(m);
   for(int i = 0;i < m;i ++){
      int x;
      cin >> x;
      while(x--){
         int y;
         cin >> y;
         --y;
         v[i] |= (1LL << y);
      }
   }
   vector<pair<long long , int>> u;
   u.emplace_back(make_pair(0LL , 0));
   for(int i = 0;i < m;i ++){
      vector<pair<long long , int>> e;
      for(auto [x , mask] : u){
         e.emplace_back(make_pair(x ^ v[i] , mask | (1 << i)));
      }
      for(auto [x , mask] : e){
         u.emplace_back(make_pair(x , mask));
      }
   }
   int best_mask = (1 << m);
   for(auto [x , mask] : u){
      long long e = (~x & M);
      int o = best_mask ^ mask;
      if(e == 0){
         int bit = __lg(o & -o);
         if((mask >> bit & 1) || (best_mask & mask) == mask || (__builtin_popcount(mask) < __builtin_popcount(best_mask))){
            best_mask = mask;
         }
      }
   }
   cout << __builtin_popcount(best_mask) << endl;
   for(int i = 0;i < m;i ++){
      if(best_mask >> i & 1){
         cout << i + 1 << " ";
      }
   }
   cout << endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 6848 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 6848 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 6848 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 6848 KB Output isn't correct
2 Halted 0 ms 0 KB -