QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#499793 | #6730. Coolbits | Umok | WA | 577ms | 5096kb | C++20 | 990b | 2024-07-31 19:18:35 | 2024-07-31 19:18:37 |
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];
void solve()
{
int n;
cin >> n;
int maxs = 0x3f3f3f3f3f3f3f3f;
for (int i = 1; i <= n;i ++)
{
int l, r;
cin >> l >> r;
maxs = min(maxs, r);
ar[i] = {l, r};
}
int ans = maxs;
for (int i = 1; i <= n;i ++)
{
if(ar[i].first <= maxs)
continue;
int l = ar[i].first, r = ar[i].second;
int x = l;
for (int i = 0; (1 << i) <= r; i ++)
{
if(x&(1<<i))
continue;
if(x+(1<<i) > r)
break;
x += (1 << i);
}
ans &= x;
}
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: 3560kb
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: 577ms
memory: 5096kb
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:
17784255 2737215 605885728 38143642 22491373 8390323 4379206 6137551 27539 8417576 9919429 912293 1206455 20237511 5879036 1194927 136520843 3048536 4514250 135007650 3467518 34457 3722470 2231961 137060588 9287005 22163538 8591246 10770330 24675258 3186746 76477501 60003201 665204 16254008 19149153...
result:
wrong answer 1st numbers differ - expected: '29882460', found: '17784255'