QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#361055 | #6510. Best Carry Player 3 | Core_65536 | WA | 1ms | 3608kb | C++20 | 995b | 2024-03-22 18:45:46 | 2024-03-22 18:45:47 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
void solve()
{
int x,y,k; cin>>x>>y>>k;
if(x>y) swap(x,y);
int len=0;
int tmp=k;
while(tmp!=0)
{
len++;
tmp=tmp>>1;
}
int xl,xr,yl,yr;
xl=x>>len; xr=x-(xl<<len);
yl=y>>len; yr=y-(yl<<len);
int m=3;
if(k==(1<<len)-1) m=2;
int t=m*(yl-xl-1);
int a=((~xr)>k)?3:2;
if(xr==((1<<len)-1)) a=1;
int b=(yr>k)?2:1;
if(yr==0) b=0;
int ans=t+a+b;
if(x==0) a=1;
if(y==0) b=0;
if(k==1||k==0) ans=(y-x);
int cnt=0;
for(int i=0;i<61;i++){
if(((x>>i)&1)!=((y>>i)&1)){
cnt+=1<<i;
}
}
if(cnt<=k) ans=1;
if(x==y) ans=0;
cout<<t<<" "<<a<<" "<<b<<endl;
cout<<ans<<endl;
}
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int T=0; cin>>T;
while(T--) solve();
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3608kb
input:
8 4 5 0 5 8 3 9 2 6 15 28 5 97 47 8 164 275 38 114514 1919 810 0 1152921504606846975 1
output:
0 1 0 1 0 2 0 2 0 2 1 3 3 1 1 5 9 1 1 11 3 2 1 6 327 2 2 331 1152921504606846972 1 1 1
result:
wrong answer 1st numbers differ - expected: '1', found: '0'