QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#459133 | #8834. Formal Fring | ucup-team3924# | WA | 81ms | 178980kb | C++20 | 1.2kb | 2024-06-29 23:03:49 | 2024-06-29 23:03:50 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
void solve(){
int N;
cin >> N;
const int MOD = 998244353;
vector<vector<int>> knap(22, vector<int>(1000100));
vector<vector<int>> knap2(22, vector<int>(1000100));
knap[21][0] = 1;
for(int i = 20; i >= 0; i --){
knap[i] = knap[i + 1];
int t = 1 << i;
for(int j = t; j <= 1000000; j ++){
knap[i][j] = (knap[i][j] + knap[i][j - t]) %MOD;
}
}
knap2[0][0] = 1;
for(int i = 0; i <= 20; i ++){
if(i)
knap2[i] = knap2[i - 1];
int t = 1 << i;
for(int j = t; j <= 1000000; j ++){
knap2[i][j] = (knap2[i][j]+ knap2[i][j - t]) %MOD;
}
}
for(int i = 1; i <= N; i ++){
int t = (1 << (31 - __builtin_clz(i)));
int next = t * 2;
int gap = (31 - __builtin_clz((next - i) * 2) - 1);
int left = max(i - t, 1);
cout << (knap[gap][i] + (gap && i - t? knap2[gap - 1][i - t]:0)) % MOD << " ";
}
cout << endl;
}
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int N = 1;
//cin >> N;
while(N --){
solve();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 71ms
memory: 178912kb
input:
10
output:
1 1 2 1 1 3 6 1 1 2
result:
ok 10 numbers
Test #2:
score: -100
Wrong Answer
time: 81ms
memory: 178980kb
input:
70
output:
1 1 2 1 1 3 6 1 1 2 2 5 1 7 26 1 1 2 2 4 4 6 6 11 5 6 6 13 1 27 166 1 1 2 2 4 4 6 6 10 10 14 14 20 20 26 26 37 25 30 30 36 36 42 42 55 13 14 14 41 1 167 1626 1 1 2 2 4 4 6
result:
wrong answer 13th numbers differ - expected: '5', found: '1'