Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define fs first
- #define sc second
- #define pb push_back
- #define int long long
- using namespace std;
- int cnt[30];
- signed main() {
- int q;
- cin >> q;
- int n = 0;
- for (int i = 0; i < q; i++) {
- int x, y;
- cin >> x >> y;
- for (int j = 0; j < 30; j++) {
- if (x & (1 << j))
- cnt[j] += y;
- }
- n += y;
- }
- int ans = 0;
- for (int i = 0; i < 30; i++) {
- if (n - cnt[i] < cnt[i]) {
- ans += (1 << i);
- }
- }
- cout << ans;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement