QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#582163#9378. Strange BinaryyuhengheAC ✓7ms3756kbC++14593b2024-09-22 15:31:292024-09-22 15:31:29

Judging History

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

  • [2024-09-22 15:31:29]
  • 评测
  • 测评结果:AC
  • 用时:7ms
  • 内存:3756kb
  • [2024-09-22 15:31:29]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using uint = unsigned int;

void solve()
{
	//首先读取要求的数
	uint n;
	cin>>n;
	vector<int> res(31); 
	for(int i=31;i>=0;i--)res[i] = (n>>i)&1; 
	for(int i=0;i<31;i++)if(res[i]==1&&res[i+1]==0)res[i]=-1,res[i+1]=1;
	bool find = 0;
	for(int i=0;i<31;++i)if(res[i]==0&&res[i+1]==0) find =1;
	if(find)cout<<"NO\n";
	else 
	{
		cout<<"YES\n";
		for(int i=1;i<=4;++i){
				for(int j=0;j<8;++j){
					cout<<res[(i-1)*8+j]<<' ';
				}
				cout<<'\n';
			}
	}
}
int main()
{
	int t;
	cin>>t;
	while(t--) solve();
} 

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3576kb

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: 3756kb

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: 0
Accepted
time: 7ms
memory: 3600kb

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 
YES
0 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 
NO
YES
1 -1 -1 -1 -1 -1 1 1 
-1...

result:

ok Accepted! (10000 test cases)

Extra Test:

score: 0
Extra Test Passed