QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#586765#9378. Strange Binaryeastcloud#WA 0ms3696kbC++201.2kb2024-09-24 15:24:452024-09-24 15:24:45

Judging History

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

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

answer


#include<bits/stdc++.h>

#define ll long long
#define pi pair<int,int>
#define vi vector<int>
#define cpy(x,y,s) memcpy(x,y,sizeof(x[0])*(s))
#define mset(x,v,s) memset(x,v,sizeof(x[0])*(s))
#define all(x) begin(x),end(x)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ary array

using namespace std;
int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0' || ch>'9')f=(ch=='-'?-1:f),ch=getchar();
    while(ch>='0' && ch<='9')x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
    return x*f;
}
void write(int x){
    if(x<0)x=-x,putchar('-');
    if(x/10)write(x/10);
    putchar(x%10+'0');
}

void solve(){
    int x=read();
    if(!x){printf("NO\n");return;}
    int now=(1<<31);write(1),putchar(' ');
    int cnt=1;
    for(int i=30;i>=0;i--){
        int val=(1<<i);
        if(abs(now+val-x)<=abs(now-val-x))now+=val,write(1);
        else now-=val,write(-1);
        cnt++;
        if(cnt==8)cnt=0,putchar('\n');
        else putchar(' ');
    }
}

int main(){
    #ifdef EAST_CLOUD
    freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    #endif

    int T=read();while(T--)solve();

    return 0;
}

详细

Test #1:

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

input:

3
0
3
5

output:

NO
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
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 Token parameter [name=checker] equals to "1", doesn't correspond to pattern "YES|NO" (test case 3)