QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#601192 | #9378. Strange Binary | Retr00 | WA | 0ms | 3600kb | C++20 | 911b | 2024-09-29 21:20:58 | 2024-09-29 21:20:58 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll T;
vector<ll> pow(33, 1);
for (int i = 1; i <= 32; i++)
pow[i] = pow[i - 1] * 2;
cin >> T;
while (T--)
{
ll n, mi = 33;
cin >> n;
vector<ll> ans(32, 0);
for (ll i = 31; i >= 0; i--)
if (n >= pow[i])
n -= pow[i], ans[i] = 1, mi = min(mi, i);
if (mi > 1)
cout << "NO\n";
else
{
for (ll i = mi; i < 31; i++)
{
if (ans[i] == 1 && ans[i + 1] == 0)
ans[i] = -1, ans[i + 1] = 1;
}
for (ll i = 0; i <= 31; i++)
{
cout << ans[i] << ' ';
if ((i + 1) % 8 == 0)
cout << '\n';
}
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3600kb
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)