QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#587142 | #9378. Strange Binary | gcc | WA | 11ms | 3708kb | C++20 | 715b | 2024-09-24 17:45:36 | 2024-09-24 17:45:37 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
void change(ll n, int v[]){
int i = 0;
while(n){
v[i] = n%2;
n /= 2;
i++;
}
}
void solve(){
ll n;
cin >> n;
int a[32];
memset(a, 0, sizeof(a));
if(n%2 == 0 || n < 3){
cout << "NO" << endl;
return;
}
n = (n - 1)/2;
change(n, a);
for(int i = 0; i < 32; i++){
if(a[i] == 0){
a[i] = -1;
}
}
a[31] = 1;
int cnt = 0;
cout << "YES" << endl;
for(int i = 0; i <= 31; i++){
cout << a[i] << ' ';
cnt++;
if(cnt%8 == 0){
cout << endl;
}
}
}
int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int _ = 1;
cin >> _;
while(_--){
solve();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3612kb
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: 3708kb
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: -100
Wrong Answer
time: 11ms
memory: 3584kb
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 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 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 NO NO NO NO YES ...
result:
wrong answer Jury's answer is YES, but Participant's answer is NO. (test case 10000)