QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#601192#9378. Strange BinaryRetr00WA 0ms3600kbC++20911b2024-09-29 21:20:582024-09-29 21:20:58

Judging History

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

  • [2024-09-29 21:20:58]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3600kb
  • [2024-09-29 21:20:58]
  • 提交

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;
}

详细

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)