QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#583784#9378. Strange BinarykircoWA 9ms3844kbC++23788b2024-09-22 22:21:142024-09-22 22:21:16

Judging History

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

  • [2024-09-22 22:21:16]
  • 评测
  • 测评结果:WA
  • 用时:9ms
  • 内存:3844kb
  • [2024-09-22 22:21:14]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define endl "\n"
#define iosy ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define rop(i,a,n) for(int i=a;i<n;i++)
using namespace std;
const int inf = 0x3f3f3f3f3f3f3f3fLL;
const int N = 2e5+10;
const int MOD = 1e9+7;
void solve(){
	int n;cin>>n;
	vector<int> a(32,-1);
	a[31]=1;
	if(n%2==0){
		cout<<"NO\n";
		return;
	}else{
		int k=(n-1)/2;
		int cnt=0;
		while(k>0){
			cnt++;
			if(k&1)a[cnt-1]=1;
			k>>=1;
		}
	}
	cout<<"YES\n";
	int j=0;
	for(int i=0;i<32;i++){
		if(j<8){
			j++;
		}else{
			cout<<"\n";
			j=1;
		}
		cout<<a[i]<<" ";
	}
	cout<<"\n";
}

signed main()
{
	iosy;
	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: 3640kb

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

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: 9ms
memory: 3812kb

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
YES
...

result:

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