QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#765035#8834. Formal Fringmhb2010WA 1ms7692kbC++14673b2024-11-20 11:42:472024-11-20 11:42:48

Judging History

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

  • [2024-11-20 11:42:48]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:7692kb
  • [2024-11-20 11:42:47]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
void ts(){cout<<"IAKIOI"<<endl;}
const int N=1.1e6, mod=998244353;
int n, dp[N], g[N], h[N];
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	dp[0]=1;
	for(int i=1; i<=n; i++){
		dp[i]=(dp[i-1]+(i&1?0:dp[i/2]))%mod;
		h[i] =(__lg(i)!=__lg(i+1))?__lg(i+1):h[i>>1];
	}
	for(int i=1; i<=20; i++){
		g[i]=dp[(1<<i)-1];
		for(int j=1; j<i; j++){
			g[i]=(g[i]+(mod-g[j])*dp[(1<<j)-1])%mod;
		}
	}
	for(int i=1; i<=n; i++){
		int ans=0;
		for(int j=1; j<=h[i]; j++){
			ans=(ans+g[j]*dp[i^(1<<j)-1<<__lg(i)-j+1]);
		}
		cout<<ans<<' ';
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 7684kb

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: 7692kb

input:

70

output:

1 1 2 1 1 3 6 1 1 2 2 5 5 11 16 1 1 2 2 4 4 6 6 11 11 16 16 27 27 43 58 1 1 2 2 4 4 6 6 10 10 14 14 20 20 26 26 37 37 48 48 64 64 80 80 107 107 134 134 177 177 235 998243573 1 1 2 2 4 4 6 

result:

wrong answer 15th numbers differ - expected: '26', found: '16'