Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- using namespace std;
- int main()
- {
- int num;
- cin >> num;
- int x = 0;
- for(int i = 0; i < num; i++) {
- cin >> x;
- }
- cin >> num;
- x = 0;
- for(int i = 0; i < num; i++) {
- int id;
- cin >> id;
- x |= (1 << id);
- }
- for(int i = 31; i >= 0; i--) {
- if(x & (1 << i)) {
- cout << i << " ";
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement