QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#543547#8834. Formal FringAITU 0 (Altair Ashurov, Almaz Shinbay, Zhambyl Maksotov)#WA 0ms3820kbC++201.2kb2024-09-01 17:09:542024-09-01 17:09:55

Judging History

This is the latest submission verdict.

  • [2024-09-01 17:09:55]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3820kb
  • [2024-09-01 17:09:54]
  • Submitted

answer

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

#define sz(x) (int)x.size();
#define all(x) x.begin(), x.end();

const int N = 1e6 + 200;
const int mod = 998244353;

int n, f[N];

void solve() {
    cin >> n;
    f[0] = 1;
    f[1] = 1;
    for (int i = 2; i <= n; ++i) {
        f[i] = f[i - 1];
        if (i % 2 == 0) {
            f[i] += f[i / 2];
            f[i] %= mod;
        }
    }
    for (int i = 1; i <= n; ++i) {
        int l = 0;
        int j = i, p = 1;
        while (true) {
            if (__builtin_popcount(j + 1) == 1) {
                break;
            }
            if (j & 1) {
                l += p;
            }
            j /= 2;
            p *= 2;
        }
        int r = i - l;
        while (r % 2 == 0) r /= 2;
        int kek = f[r];
        if (r != i)  {
            r /= 2;
            while (r >= 1) {
                kek += f[r];
                kek %= mod;
                r /= 2;
            }
        }
        cout << (f[l] * 1ll * kek) % mod << " ";
    }
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int T = 1;
    /* cin >> T; */
    while (T--) solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

10

output:

1 1 2 1 1 3 6 1 1 2 

result:

ok 10 numbers

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3592kb

input:

70

output:

1 1 2 1 1 3 6 1 1 2 2 3 3 9 26 1 1 2 2 4 4 6 6 3 3 6 6 9 9 35 166 1 1 2 2 4 4 6 6 10 10 14 14 20 20 26 26 3 3 6 6 12 12 18 18 9 9 18 18 35 35 201 1626 1 1 2 2 4 4 6 

result:

wrong answer 12th numbers differ - expected: '5', found: '3'