QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#457917 | #8834. Formal Fring | ucup-team1004# | WA | 2ms | 46732kb | C++14 | 1022b | 2024-06-29 14:46:49 | 2024-06-29 14:46:53 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#include"debug.h"
#else
#define debug(...) void()
#endif
#define all(x) (x).begin(),(x).end()
template<class T>
auto ary(T *a,int l,int r){
return vector<T>{a+l,a+1+r};
}
using ll=long long;
using ull=unsigned ll;
const int N=1e6+10,mod=998244353;
int n,f[21][N],ans[N];
int main(){
cin>>n;
f[20][0]=1;
for(int k=19;k>=0;k--){
copy(f[k+1],f[k+1]+1+n,f[k]);
for(int i=(1<<k);i<=n;i++){
(f[k][i]+=f[k][i-(1<<k)])%=mod;
}
}
for(int i=1;i<=n;i++){
int k=__lg(i);
if(i==(1<<k+1)-1){
ans[i]=f[0][i];
}else if(i<(1<<k)+(1<<k-1)){
ans[i]=f[0][i-(1<<k)];
}else{
// debug(i);
int len=__lg((1<<k+1)-1-i);
// debug(len);
ans[i]=f[len+1][i];
for(int j=0;j<=len&&(1<<j)<=i-(1<<k);j++){
// debug(j,f[j][i-(1<<k)-(1<<j)]);
(ans[i]+=f[j][i-(1<<k)-(1<<j)])%=mod;
}
}
}
for(int i=1;i<=n;i++)printf("%d%c",ans[i],"\n "[i<n]);
return 0;
}
#ifdef DEBUG
#include"debug.hpp"
#endif
詳細信息
Test #1:
score: 100
Accepted
time: 2ms
memory: 46708kb
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: 46732kb
input:
70
output:
1 1 2 1 1 3 6 1 1 2 2 5 4 10 26 1 1 2 2 4 4 6 6 11 10 14 14 24 20 46 166 1 1 2 2 4 4 6 6 10 10 14 14 20 20 26 26 37 36 46 46 60 60 74 74 98 94 114 114 160 140 306 1626 1 1 2 2 4 4 6
result:
wrong answer 13th numbers differ - expected: '5', found: '4'