# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
697661 |
2023-02-10T16:50:19 Z |
finn__ |
Bitwise (BOI06_bitwise) |
C++17 |
|
1000 ms |
300 KB |
#include <bits/stdc++.h>
using namespace std;
vector<unsigned> k, a, b;
void find_max(vector<unsigned> &v, size_t i, unsigned &max_value)
{
if (i == v.size())
{
auto it = v.begin();
unsigned x = UINT_MAX;
for (size_t j = 0; j < k.size(); j++)
{
unsigned y = 0;
for (size_t h = 0; h < k[j]; h++)
y |= *it++;
x &= y;
}
max_value = max(max_value, x);
return;
}
for (v[i] = a[i]; v[i] <= b[i]; v[i]++)
find_max(v, i + 1, max_value);
}
int main()
{
size_t n, p;
cin >> n >> p;
k = vector<unsigned>(p);
a = vector<unsigned>(n);
b = vector<unsigned>(n);
for (unsigned &x : k)
cin >> x;
for (size_t i = 0; i < n; i++)
cin >> a[i] >> b[i];
unsigned max_value = 0;
vector<unsigned> v(n);
find_max(v, 0, max_value);
cout << max_value << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
12 ms |
212 KB |
Output is correct |
6 |
Correct |
11 ms |
300 KB |
Output is correct |
7 |
Execution timed out |
1092 ms |
212 KB |
Time limit exceeded |
8 |
Execution timed out |
1090 ms |
212 KB |
Time limit exceeded |
9 |
Execution timed out |
1097 ms |
212 KB |
Time limit exceeded |
10 |
Execution timed out |
1086 ms |
212 KB |
Time limit exceeded |
11 |
Execution timed out |
1087 ms |
212 KB |
Time limit exceeded |
12 |
Execution timed out |
1086 ms |
212 KB |
Time limit exceeded |
13 |
Execution timed out |
1084 ms |
212 KB |
Time limit exceeded |
14 |
Execution timed out |
1081 ms |
212 KB |
Time limit exceeded |
15 |
Execution timed out |
1084 ms |
212 KB |
Time limit exceeded |
16 |
Execution timed out |
1092 ms |
212 KB |
Time limit exceeded |
17 |
Execution timed out |
1087 ms |
212 KB |
Time limit exceeded |
18 |
Execution timed out |
1082 ms |
212 KB |
Time limit exceeded |
19 |
Execution timed out |
1085 ms |
212 KB |
Time limit exceeded |
20 |
Execution timed out |
1077 ms |
212 KB |
Time limit exceeded |