QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#499899 | #6730. Coolbits | Umok | WA | 0ms | 3596kb | C++20 | 1.0kb | 2024-07-31 20:03:38 | 2024-07-31 20:03:38 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
const int N = 1e5 + 5;
#define int long long
typedef pair<int, int> PII;
#define MAX LONG_LONG_MAX
const int mod = 1e9 + 7;
PII ar[N];
int ans;
int n;
bool check(int k, int t)
{
int x = ans | k;
for (int i = 1; i <= n; i++)
{
if (x > ar[i].second)
return 0;
int y = ar[i].first & x;
if (!y)
{
y = ar[i].first >> t;
y |= 1;
y <<= t;
}
if (y > ar[i].second)
return 0;
}
return 1;
}
void solve()
{
cin >> n;
int maxs = 0x3f3f3f3f3f3f3f3f;
for (int i = 1; i <= n; i++)
{
int l, r;
cin >> l >> r;
ar[i] = {l, r};
}
for (int i = 31; ~i; i--)
{
if (check(1 << i, i))
{
ans |= (1 << i);
}
}
cout << ans << endl;
}
signed main()
{
int tcase;
cin >> tcase;
while (tcase--)
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3596kb
input:
2 3 0 8 2 6 3 9 1 1 100
output:
6 95
result:
wrong answer 2nd numbers differ - expected: '100', found: '95'