Submission #405924

#TimeUsernameProblemLanguageResultExecution timeMemory
405924working05Bitwise (BOI06_bitwise)C++17
0 / 100
1 ms320 KiB
#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 timeMemoryGrader output
Fetching results...