QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#646656#9378. Strange BinaryhuanxielAC ✓14ms3868kbC++20894b2024-10-17 02:35:572024-10-17 02:35:58

Judging History

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

  • [2024-10-17 02:35:58]
  • 评测
  • 测评结果:AC
  • 用时:14ms
  • 内存:3868kb
  • [2024-10-17 02:35:57]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
void solve() {
    int n;
    cin >> n;
    if (n % 4 == 0) {
        cout << "NO\n";
        return;
    }
    int a[32]{};
    int ans[32]{};
    for (int i = 30; i >= 0; i--) {
        a[i] = n >> i & 1;
    }
    vector<int> v;
    for (int i = 31; i >= 0; i--) {
        v.pb(i);
        if (a[i] == 1) {
            for (auto p : v)
                ans[p] = -1;
            ans[v[0]] = 1;
            v.clear();
        }
    }
    cout << "YES\n";
    for (int i = 0; i <= 31; i++) {
        cout << ans[i];
        if (i % 8 == 7)
            cout << '\n';
        else
            cout << " ";
    }
}

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int t;
    cin >> t;
    while (t--)
        solve();
    return 0;
}

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

詳細信息

Test #1:

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

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

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: 14ms
memory: 3572kb

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