QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#499920 | #6730. Coolbits | Umok | WA | 0ms | 3620kb | C++20 | 1.1kb | 2024-07-31 20:11:28 | 2024-07-31 20:11:30 |
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, 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;
}
else
{
y = ar[i].first;
}
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 = 32; ~i; i--)
{
if (check(1 << i, i))
{
ans |= (1 << i);
}
}
cout << ans << endl;
}
signed main()
{
int tcase;
cin >> tcase;
while (tcase--)
solve();
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3620kb
input:
2 3 0 8 2 6 3 9 1 1 100
output:
6 -1
result:
wrong answer 2nd numbers differ - expected: '100', found: '-1'