QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#588709 | #9378. Strange Binary | Hide_In_The_Shadow | WA | 0ms | 3568kb | C++23 | 1.4kb | 2024-09-25 14:09:02 | 2024-09-25 14:09:03 |
Judging History
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;
}
详细
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)