fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int n, A, B;
  6. int const N = 1e5 + 5;
  7. int a[N];
  8. vector <int> kq;
  9.  
  10. int main()
  11. {
  12. // freopen("me","r",stdin);
  13. // freopen("cung","w",stdout);
  14. ios_base::sync_with_stdio(false);
  15. cin.tie(0);
  16. cout.tie(0);
  17.  
  18. cin >> n >> A >> B;
  19. for(int i = 1 ; i <= n ; i++)
  20. cin >> a[i];
  21.  
  22. for(int i = 1 ; i <= n ; i++)
  23. if(((A | a[i]) != A) && ((a[i] & B) == a[i]))
  24. {
  25. A = A | a[i] ;
  26. kq.push_back(i);
  27. }
  28.  
  29. if(A != B)
  30. {
  31. cout << -1;
  32. exit(0);
  33. }
  34.  
  35. cout << kq.size() << '\n';
  36.  
  37. for(int v : kq) cout << v << ' ';
  38.  
  39. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
0