#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
7 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
316 KB |
Output isn't correct |
9 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
10 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
320 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
13 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
14 |
Incorrect |
1 ms |
320 KB |
Output isn't correct |
15 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
16 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
17 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
18 |
Incorrect |
1 ms |
312 KB |
Output isn't correct |
19 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
20 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |