QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#471871#8834. Formal FringSunsetGlow95WA 1ms5748kbC++20998b2024-07-11 10:39:112024-07-11 10:39:12

Judging History

This is the latest submission verdict.

  • [2024-07-11 10:39:12]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 5748kb
  • [2024-07-11 10:39:11]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;

const int MXN = 1000005;
const int DVS = 998244353;
int N, cnt[MXN], bcnt[MXN];

int main() {
  cin >> N;
  cnt[0] = bcnt[0] = 1;
  for (int i(1); i <= N; i <<= 1) {
    for (int j(i); j <= N; ++j) cnt[j] = (cnt[j] + cnt[j - i]) % DVS;
  }
  for (int i(1); i <= N; ++i) {
    bcnt[i] = cnt[i];
    for (int j(1); j <= i; j <<= 1)
      if (i & j)
        bcnt[i] = (bcnt[i] - bcnt[i / j - 1] * 1LL * cnt[i % j] % DVS + DVS) % DVS;
  }
//  for (int i(1); i <= N; ++i) cout << cnt[i] << ' ';
//  cout << endl;
//  for (int i(1); i <= N; ++i) cout << bcnt[i] << ' ';
//  cout << endl;
  for (int i(1); i <= N; ++i) {
    int hb(1);
    while (hb <= i) hb <<= 1;
    hb >>= 1;
    int d(min(i - hb, 2 * hb - 2 - i));
    int o(0);
    for (int j(1); j <= i; j <<= 1)
      if (i & j && j - (i % j) > d) cout << i << ':' << j << endl,
        o = (o + bcnt[i / j - 1] * 1LL * cnt[i % j] % DVS) % DVS;
    cout << o << ' ';
  }
  cout << endl;
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 5748kb

input:

10

output:

1:1
1 2:2
1 3:1
3:2
2 4:4
1 5:4
1 6:2
6:4
3 7:1
7:2
7:4
6 8:8
1 9:8
1 10:8
2 

result:

wrong output format Expected integer, but "1:1" found