QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#361053#8337. Counter Reset ProblemCore_65536WA 0ms3728kbC++20995b2024-03-22 18:43:492024-03-22 18:43:50

Judging History

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

  • [2024-03-22 18:43:50]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3728kb
  • [2024-03-22 18:43:49]
  • 提交

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: 0ms
memory: 3728kb

input:

2
19 23

output:

6 1 0
4
6 1 0
4

result:

wrong answer 1st numbers differ - expected: '51', found: '6'