QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#584278#9378. Strange BinaryNiiuWA 8ms3788kbC++20743b2024-09-23 11:11:532024-09-23 11:11:54

Judging History

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

  • [2024-09-23 11:11:54]
  • 评测
  • 测评结果:WA
  • 用时:8ms
  • 内存:3788kb
  • [2024-09-23 11:11:53]
  • 提交

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;
    if((x-1)&1)
    {
        cout<<"NO\n";
        return ;
    }
    int k=(x-1)/2;
    for(int i=30;i>=0;i--)
    {
        if((k>>i)&1)
        {
            idx[i]=1;
        }
    }
    cout<<"YES\n";
    int cnt=0;
    for(int i=0;i<32;++i)
    {
        cout<<idx[i]<<' ';
        cnt++;
        if(cnt%8==0)cout<<'\n';
    }
    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;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
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:

ok Accepted! (3 test cases)

Test #2:

score: 0
Accepted
time: 0ms
memory: 3572kb

input:

2
0
1073741823

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 


result:

ok Accepted! (2 test cases)

Test #3:

score: -100
Wrong Answer
time: 8ms
memory: 3788kb

input:

10000
324097321
555675086
304655177
991244276
9980291
383616352
1071036550
795625380
682098056
68370721
969101726
685975156
973896269
354857775
196188000
606494155
754416123
467588829
495704303
558090120
618002000
491488050
741575237
9937018
10028830
140094825
652839595
357724903
516690123
817724271...

output:

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 

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 

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 

NO
NO
NO
NO
Y...

result:

wrong answer Jury's answer is YES, but Participant's answer is NO. (test case 10000)