QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#734821 | #9701. Cat | SSAABBEERR | WA | 178ms | 3780kb | C++20 | 1.4kb | 2024-11-11 15:19:30 | 2024-11-11 15:19:30 |
Judging History
answer
#include<bits/stdc++.h>
#define lowbit(x) (x & (-x))
#define endl "\n"
// #define ll long long
#define int long long
#define fi first
#define se second
using namespace std;
#define pii pair<int, int>
#define rep(i, a, b) for(int i = a; i <= b; i ++ )
#define pre(i, a, b) for(int i = a; i >= b; i -- )
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
mt19937_64 rnd(time(0));
const int N = 1e6 + 10;
int n;
int g(int x)
{
if(x % 4 == 3) return 0;
else if(x % 4 == 2) return x + 1;
else if(x % 4 == 1) return 1;
else return x;
}
void solve()
{
int l, r, s;
cin >> l >> r >> s;
if(r - l + 1 <= 100)
{
int ans = -1;
rep(i, l, r)
{
rep(j, i, r)
{
if((g(j) ^ g(i - 1)) <= s) ans = max(ans, j - i + 1);
}
}
cout << ans << endl;
}
else
{
int tl = l / 4;
if(l % 4 != 0) tl ++ ;
int tr = r / 4;
int ans = -1;
tl *= 4;
tr *= 4;
tr += 3;
rep(i, l, tl)
{
rep(j, tr, r)
{
if((g(j) ^ g(i - 1)) <= s) ans = max(ans, j - i + 1);
}
}
cout << ans << endl;
}
}
signed main()
{
IOS;
int _;
_ = 1;
cin >> _;
while(_ -- )
{
solve();
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 178ms
memory: 3780kb
input:
500000 28316250877914575 822981260158260522 1779547116602436425 335408917861648772 578223540024979445 74859962623690079 252509054433933447 760713016476190629 919845426262703496 522842184971407775 585335723211047202 148049062628894322 84324828731963982 354979173822804784 1001312150450968415 269587449...
output:
-1 -1 -1 -1 -1 -1 -1 42350729279043822 64865315101301174 -1 -1 108731400892235542 120906461794646288 -1 -1 450247658658833134 -1 30453712563541401 -1 -1 -1 267026204612918430 -1 -1 -1 225124502059953684 -1 -1 -1 -1 -1 -1 -1 -1 45509761782668702 -1 672817210013611845 261651592252144779 17693081226467...
result:
wrong answer 1st numbers differ - expected: '794665009280345948', found: '-1'