QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#588709#9378. Strange BinaryHide_In_The_ShadowWA 0ms3568kbC++231.4kb2024-09-25 14:09:022024-09-25 14:09:03

Judging History

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

  • [2024-09-25 14:09:03]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3568kb
  • [2024-09-25 14:09:02]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define fio std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
template<typename T>inline void read(T &x){
	x=0;
	char c=getchar();
	T ret=0;
	while(!isdigit(c))ret|=!(c^'-'),c=getchar();
	while(isdigit(c))x=(x<<3)+(x<<1)+(c^48),c=getchar();
	if(ret)x=(~x)+1;
	return;
}
template<typename T>inline void print(T x){
	if(x<0)putchar('-'),x=(~x)+1;
	if(x>9)print(x/10);
	putchar((x-x/10*10)^48);
	return;
}
template<typename T>inline void wr1(T x){
	print(x);
	putchar(' ');
	return;
}
template<typename T>inline void wr2(T x){
	print(x);
	putchar('\n');
	return;
}
int t,n;
int main(){
	read(t);
    while(t--){
        read(n);
        if(n==0||((n&(-n))>2)){
            puts("NO");
            continue;
        }
        puts("YES");
        bool pre=0;
        for(int i=31;i>=0;--i){
            if(!n){
                wr2(0);
                continue;
            }
            if(pre){
                wr1(-1);
                if(1&(n>>i)){
                    pre=0;
                    n^=1<<i;
                }
            }
            else{
                wr1(1);
                if(!(1&(n>>i))){
                    pre=1;
                }
            }
            if(i%8==0)putchar('\n');
        }
    }
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3568kb

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)