QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#582596#9378. Strange BinaryRUOHUIAC ✓13ms3752kbC++201021b2024-09-22 16:56:082024-09-22 16:56:08

Judging History

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

  • [2024-09-22 16:56:08]
  • 评测
  • 测评结果:AC
  • 用时:13ms
  • 内存:3752kb
  • [2024-09-22 16:56:08]
  • 提交

answer

#include "bits/stdc++.h"
#define int long long
#define ull unsigned long long
#define double long double
#define PII pair<int,int>
#define TIII tuple<int,int,int>
#define LL __int128
#define eps 1e-6
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
constexpr int N = 2e5 + 10, M = 2e6 + 10, mod = 1e9 + 7, inf = 1e18;
int n, m;

void solve()
{
    cin >> n;
    if (n % 4 == 0)
    {
        cout << "NO" << endl;
        return;
    }
    vector<int> a(32, 1);
    int x = ((1ll << 32) - 1) ^ n;
    for (int i = 1; i <= 31; i++)
    {
        if (x >> i & 1) a[i - 1] = -1;
    }
    cout << "YES\n";
    if (n % 2 == 0) a[0] = 0;
    for (int i = 0; i <= 31; i++)
    {
        cout << a[i] << " \n"[(i + 1) % 8 == 0];
    }
}

signed main()
{
    std::ios::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);

    int Cases = 1;
    cin >> Cases;
    while (Cases--)
    {
        solve();
    }
    return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3752kb

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: 3548kb

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: 0
Accepted
time: 13ms
memory: 3556kb

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
YES
0 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
NO
YES
1 -1 -1 -1 -1 -1 1 1
-1 -1 1 -1 -1 1...

result:

ok Accepted! (10000 test cases)

Extra Test:

score: 0
Extra Test Passed