# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
949038 | Iskachun | Bitwise (BOI06_bitwise) | C++17 | 1073 ms | 432 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
int mx;
void f(vector<pair<int,int>>& a, int pos, int curr) {
if (pos == a.size()) {
mx = max(mx, curr);
//cout << curr << '\n';
return;
}
for (int x = a[pos].first; x <= a[pos].second; x++) {
//cout << x << ' ';
f(a, pos + 1, curr | x);
}
}
int main() {
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, p; cin >> n >> p;
vector<int> k(p);
for (int &x : k) cin >> x;
int ans = (1ll << 31) - 1;
for (int l : k) {
vector<pair<int,int>> a(l);
for (auto &x : a) cin >> x.first >> x.second;
//for (auto x : a) cout << x.first << x.second << '\n';
mx = 0;
f(a, 0, 0);
//cout << mx << '\n';
ans &= mx;
}
cout << ans;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |