QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#593662 | #9378. Strange Binary | wjynb666 | WA | 0ms | 3552kb | C++14 | 774b | 2024-09-27 15:24:31 | 2024-09-27 15:24:31 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define read_fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
void solve(){
int n;
cin>>n;
if(n % 4==0){
cout<<"NO\n";
return ;
}
vector<int> b(32,-2);
for(int i=31;i>=0;i--){
int cur=(n>>i)&1;
if(!cur && b[i]==-2){
b[i]=1;
b[i-1]=-1;
}else if(!cur && b[i]==-1){
b[i-1]=-1;
}else if(cur && b[i]==-2) {
b[i]=1;
}
}
reverse(b.begin(),b.end());
cout<<"YES\n";
for(int i=0;i<32;i++){
cout<<b[i]<<' ';
if((i+1)%8==0) cout<<"\n";
}
}
int main()
{
read_fast;
int t;
cin>>t;
while(t--) solve();
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3552kb
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)