# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
405924 | working05 | Bitwise (BOI06_bitwise) | C++17 | 1 ms | 320 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, p; cin >> n >> p;
vector<int> a(p);
vector<pair<int, int>> b(n);
for(int i = 0; i < p; ++i){
cin >> a[i];
}
for(int i = 0; i < n; ++i){
cin >> b[i].first >> b[i].second;
}
int ans = 0;
for(int i = (1ll << 32); i; i >>= 1){
int f = 1;
int pos = 0;
for(int j = 0; j < p; ++j){
int yes = 0;
for(int k = 0; k < a[j]; ++k){
if(b[pos].first <= i && b[pos].second >= i){
yes = 1;
}
++pos;
}
if(!yes){
f = 0;
break;
}
}
if(f){
ans |= i;
}
}
cout << ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |