QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#582384#9378. Strange BinaryChief_NingAC ✓12ms3652kbC++141.7kb2024-09-22 16:13:122024-09-22 16:13:13

Judging History

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

  • [2024-09-22 16:13:13]
  • 评测
  • 测评结果:AC
  • 用时:12ms
  • 内存:3652kb
  • [2024-09-22 16:13:12]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define endl "\n"
#define pq priority_queue<int>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define debug1(x) cout<<x<<endl;
#define debug2(a,b) cout<<a<<" "<<b<<endl;
const int INF = 0x3f3f3f3f;//无穷大
const int inf = 0xc0c0c0c0;//无穷小
const int MOD = 1;
const int N = 1;

/*
 ________  ___  ___  ___  _______   ________ ________   ___  ________   ________
|\   ____\|\  \|\  \|\  \|\  ___ \ |\  _____\\   ___  \|\  \|\   ___  \|\   ____\
\ \  \___|\ \  \\\  \ \  \ \   __/|\ \  \__/\ \  \\ \  \ \  \ \  \\ \  \ \  \___|
 \ \  \    \ \   __  \ \  \ \  \_|/_\ \   __\\ \  \\ \  \ \  \ \  \\ \  \ \  \  ___
  \ \  \____\ \  \ \  \ \  \ \  \_|\ \ \  \_| \ \  \\ \  \ \  \ \  \\ \  \ \  \|\  \
   \ \_______\ \__\ \__\ \__\ \_______\ \__\   \ \__\\ \__\ \__\ \__\\ \__\ \_______\
    \|_______|\|__|\|__|\|__|\|_______|\|__|    \|__| \|__|\|__|\|__| \|__|\|_______|
                                                                                     */


void ChiefNing()
{
    int x;
    cin>>x;
    bitset<32> bt=x;
    int ans[32];
    ans[31]=1;
    if(x%4==0){
        cout<<"NO"<<endl;
        return ;
    }
    cout<<"YES"<<endl;
    int k=0;
    for(int i=31;i>0;i--){
        if(bt.test(i)==0){
            ans[i-1]=-1;
        }
        else if(bt.test(i)==1){
            ans[i-1]=1;
        }
    }
    if(x%2==0)ans[0]=0;
    for(int i=0;i<32;i++){
        cout<<ans[i]<<(((i+1)%8==0)?"\n":" ");
    }
}

signed main(void)
{
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int _;
    cin>>_;
    while(_--)
        ChiefNing();
    return 0;
}

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

詳細信息

Test #1:

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

ok Accepted! (3 test cases)

Test #2:

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

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: 12ms
memory: 3652kb

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

result:

ok Accepted! (10000 test cases)

Extra Test:

score: 0
Extra Test Passed