QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#583858#9378. Strange BinarysutuWA 0ms3580kbC++20903b2024-09-22 23:10:372024-09-22 23:10:37

Judging History

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

  • [2024-09-22 23:10:37]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3580kb
  • [2024-09-22 23:10:37]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
#define endl "\n"
typedef long long ll;
void solved() {
  int n;
  cin >> n;
  if (n <= 1) {
    cout << "NO" << endl;
    return;
  }
  int a[32];
  fill(a, a + 31, -1);
  a[31] = 1;
  for (int i = 31; i >= 0; i--) {
    if ((1 << i) & n) {
      if (i > 0) {
        if (a[i + 1] == 0 || a[i] == 1) {
          a[i - 1] = 1;
        } else {
          a[i] = 0;
        }
      }
    }
  }
  if (n % 2 == 0) {
    a[0] -= 1;
  }
  for (int i = 0; i < 31; i++) {
    a[i + 1] += a[i] / 2;
    a[i] %= 2;
  }

  cout << "YES" << endl;
  for (int i = 0; i < 32; i++) {
    cout << a[i] << " ";
    if ((i + 1) % 8 == 0) cout << endl;
  }
  cout << (1 << 30) - 1 << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) solved();

  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3580kb

input:

3
0
3
5

output:

NO
YES
-1 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 
1073741823
YES
-1 -1 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 
1073741823

result:

wrong answer Token parameter [name=checker] equals to "1073741823", doesn't correspond to pattern "YES|NO" (test case 3)