QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#623798 | #6730. Coolbits | k1nsom | WA | 253ms | 5504kb | C++17 | 1.1kb | 2024-10-09 14:02:32 | 2024-10-09 14:02:32 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define PII pair<int, int>
mt19937_64 rnd(time(0));
void solve()
{
int n;
cin >> n;
vector<PII> a(n + 1);
for (int i = 1; i <= n; i++)
cin >> a[i].first >> a[i].second;
int ans = 0;
for (int j = 30; j >= 0; j--)
{
int l = ans | (1 << j), r = ans | ((1 << j + 1) - 1);
bool ok = 1;
for (int i = 1; i <= n; i++)
{
if (max(l, a[i].first) > min(r, a[i].second))
{
ok = 0;
}
}
if (!ok)
{
for (int i = 1; i <= n; i++)
if (a[i].first & (1 << j))
a[i].first ^= (1 << j);
}
else
{
for (int i = 1; i <= n; i++)
if (!(a[i].first & (1 << j)))
a[i].first ^= (1 << j);
}
ans |= ok << j;
}
cout << ans << endl;
}
signed main()
{
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int t = 1;
cin >> t;
while (t--)
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3612kb
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: 253ms
memory: 5504kb
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:
93281727 178897983 605885695 115212287 156499967 48236191 88080383 142606335 167772159 310407167 143917055 41943039 68315295 100663295 114930940 75497471 419430399 99516415 55894474 134742015 271900671 83920537 203423743 85983231 402653183 59617279 55574527 75698175 312758271 83886079 50331647 20132...
result:
wrong answer 1st numbers differ - expected: '29882460', found: '93281727'