QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#583735#9378. Strange BinaryNiiuWA 0ms3596kbC++20859b2024-09-22 21:44:062024-09-22 21:44:07

Judging History

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

  • [2024-09-22 21:44:07]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3596kb
  • [2024-09-22 21:44:06]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;

void solve()
{
	int x;
    cin>>x;
    if(x==0)
    {
        cout<<"NO\n";
        return ;
    }
    vector<int>idx(32,-1);
    idx[31]=1;
    x--;
    for(int i=31;i>=0;i--)
    {
        if((x>>i)&1)
        {
            idx[i]=1;
        }
    }
    int flag=0;
    for(int i=0;i+1<31;i++)
    {
        if(idx[i+1]==1&&idx[i]==1)flag=1;
    }
    if(flag==1)
    {
        cout<<"YES\n";
    }
    else
    {
        cout<<"YES\n";
        int cnt=0;
        for(int i=0;i<32;i++)
        {
            cout<<idx[i]<<' ';
            cnt++;
            if(cnt%8==0)cout<<'\n';
        }
    }
}

signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	int T=1;
	cin>>T;
	while(T--)
	{
		solve();
	}	
	return 0;
}

詳細信息

Test #1:

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

input:

3
0
3
5

output:

NO
YES
-1 1 -1 -1 -1 -1 -1 -1 
-1 -1 -1 -1 -1 -1 -1 -1 
-1 -1 -1 -1 -1 -1 -1 -1 
-1 -1 -1 -1 -1 -1 -1 1 
YES
-1 -1 1 -1 -1 -1 -1 -1 
-1 -1 -1 -1 -1 -1 -1 -1 
-1 -1 -1 -1 -1 -1 -1 -1 
-1 -1 -1 -1 -1 -1 -1 1 

result:

wrong answer Offend Limitation 3. (test case 3)