QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#588435#9378. Strange BinaryNanako7_ixWA 0ms3556kbC++141.0kb2024-09-25 11:07:482024-09-25 11:43:00

Judging History

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

  • [2024-09-25 11:43:00]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3556kb
  • [2024-09-25 11:07:48]
  • 提交

answer

#include<bits/stdc++.h>
#define pii pair<int, int>
#define endl "\n"
#define setpre(x) fixed << setprecision(x)
#define FOR(i, l, r) for(int i = l; i <= r; ++i)
#define ROF(i, l, r) for(int i = r; i >= l; --i)
#define fi first
#define se second
using namespace std;
using LL = long long;
constexpr int MAXN = 5e5 + 10;
constexpr int inf = 0x3f3f3f3f;
constexpr LL  INF = 0x3f3f3f3fffffffff;

void solve() {
    int n;
    cin >> n;
    if((n & 3) == 0) {
        cout << "NO\n";
        return;
    }
    cout << "YES\n";
    vector<int> a(32);
    FOR(i, 0, 31) a[i] = n >> i & 1;
    for(int i = 0; i < 32; ++i) {
        if(a[i] == 1 && a[i + 1] == 0) {
            a[i] = -1, a[i + 1] = 1;
        }
    }
    for(int i = 0; i < 4; ++i) {
        for(int j = i * 8; j < (i + 1) * 8; ++j) {
            cout << a[j] << ' ';
        }
        cout << endl;
    }
}

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

详细

Test #1:

score: 0
Wrong Answer
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:

wrong answer Offend Limitation 3. (test case 3)