QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#499920#6730. CoolbitsUmokWA 0ms3620kbC++201.1kb2024-07-31 20:11:282024-07-31 20:11:30

Judging History

你现在查看的是最新测评结果

  • [2024-07-31 20:11:30]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3620kb
  • [2024-07-31 20:11:28]
  • 提交

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;
    int maxs = 0x3f3f3f3f3f3f3f3f;
    for (int i = 1; i <= n; i++)
    {
        int l, r;
        cin >> l >> r;
        ar[i] = {l, r};
    }

    for (int i = 32; ~i; i--)
    {
        if (check(1 << i, i))
        {
            ans |= (1 << i);
        }
    }
    cout << ans << endl;
}
signed main()
{
    int tcase;
    cin >> tcase;
    while (tcase--)
        solve();
    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3620kb

input:

2
3
0 8
2 6
3 9
1
1 100

output:

6
-1

result:

wrong answer 2nd numbers differ - expected: '100', found: '-1'