QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#499886 | #6730. Coolbits | Umok | WA | 458ms | 5244kb | C++20 | 1.0kb | 2024-07-31 19:57:21 | 2024-07-31 19:57:21 |
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: 100
Accepted
time: 0ms
memory: 3488kb
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: 458ms
memory: 5244kb
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 33554430 33554429 33554428 33554427 33554426 33554425 33554424 33554423 33554422 33554421 33554420 33554419 33554418 33554417 33554416 33554415 33554414 33554413 33554412 33554411 33554410 33554409 33554408 33554407 33554406 33554405 33554404 33554403 33554402 33554401 33554400 33554399 335...
result:
wrong answer 1st numbers differ - expected: '29882460', found: '33554431'