QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#499932 | #6730. Coolbits | Umok | WA | 485ms | 5088kb | C++20 | 1.1kb | 2024-07-31 20:18:26 | 2024-07-31 20:18:33 |
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;
ans = 0;
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: 100
Accepted
time: 0ms
memory: 3532kb
input:
2 3 0 8 2 6 3 9 1 1 100
output:
6 100
result:
ok 2 number(s): "6 100"
Test #2:
score: -100
Wrong Answer
time: 485ms
memory: 5088kb
input:
1117 74 234256176 451122435 614716780 701954053 31102604 284818525 528763990 809400397 40637446 612671528 329403504 936190213 112402633 729525189 248142852 481053286 30877745 700834811 529884578 749041634 146522084 758550567 934650972 996096650 538751855 856147351 170918541 975066425 253153230 35361...
output:
33554431 16777215 605885728 115213978 33554431 16777215 16777215 134217727 33554431 67108863 144137157 42855333 67108863 67108863 67108863 33554431 268435455 33554431 16777215 135007650 67108863 4194303 134217727 86118041 405496044 59618653 55717970 75700110 67108863 91784122 57712698 134217727 6000...
result:
wrong answer 1st numbers differ - expected: '29882460', found: '33554431'