QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#499499 | #6730. Coolbits | ssmy | WA | 95ms | 4820kb | C++20 | 1.0kb | 2024-07-31 14:59:56 | 2024-07-31 14:59:56 |
Judging History
answer
#include <cstdio>
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int T, n;
int l[maxn], r[maxn], now[maxn];
int main ()
{
cin>>T;
while (T--) {
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
cin>>n;
for (int i = 1; i <= n; ++i)
cin>>l[i]>>r[i], now[i] = 0;
int ans = 0;
for (int i = 31; i >= 0; --i) {
bool flag = true;
for (int j = 1; j <= n && flag; ++j) {
int nl = now[j] | (1 << i), nr = now[j] | ((2 << i) - 1);
if (nl > r[j] || nr < l[j])
flag = false;
}
if (flag) {
for (int j = 1; j <= n; ++j)
now[j] |= 1 << i;
ans |= 1 << i;
}
else {
for (int j = 1; j <= n; ++j) {
int nl = now[j] | (1 << i), nr = now[j] | ((2 << i) - 1);
// if (nl <= r[j] && nr >= l[j] && nl - 1 <= l[j])
// now[j] |= 1 << i;
}
}
}
cout<<ans<<endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3716kb
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: 95ms
memory: 4820kb
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:
0 0 605885728 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 651037082 0 0 0 0 0 0 0 0 0 0 0 0 850937702 0 612072952 0 0 0 0 0 0 0 0 0 0 0 0 268435456 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 936819481 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
wrong answer 1st numbers differ - expected: '29882460', found: '0'