Submission #949038

# Submission time Handle Problem Language Result Execution time Memory
949038 2024-03-18T20:38:34 Z Iskachun Bitwise (BOI06_bitwise) C++17
15 / 100
1000 ms 432 KB
#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;
}

Compilation message

bitwise.cpp: In function 'void f(std::vector<std::pair<int, int> >&, int, int)':
bitwise.cpp:8:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |     if (pos == a.size()) {
      |         ~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Incorrect 418 ms 432 KB Output isn't correct
8 Execution timed out 1061 ms 348 KB Time limit exceeded
9 Execution timed out 1048 ms 348 KB Time limit exceeded
10 Execution timed out 1022 ms 348 KB Time limit exceeded
11 Execution timed out 1032 ms 348 KB Time limit exceeded
12 Execution timed out 1065 ms 348 KB Time limit exceeded
13 Execution timed out 1047 ms 348 KB Time limit exceeded
14 Execution timed out 1020 ms 344 KB Time limit exceeded
15 Execution timed out 1056 ms 348 KB Time limit exceeded
16 Execution timed out 1042 ms 348 KB Time limit exceeded
17 Execution timed out 1020 ms 344 KB Time limit exceeded
18 Execution timed out 1022 ms 348 KB Time limit exceeded
19 Execution timed out 1073 ms 348 KB Time limit exceeded
20 Execution timed out 1066 ms 348 KB Time limit exceeded