QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#593662#9378. Strange Binarywjynb666WA 0ms3552kbC++14774b2024-09-27 15:24:312024-09-27 15:24:31

Judging History

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

  • [2024-09-27 15:24:31]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3552kb
  • [2024-09-27 15:24:31]
  • 提交

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)