QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#406515#8543. Periodic SequencexiaolangWA 65ms5672kbC++14546b2024-05-07 13:09:352024-05-07 13:09:37

Judging History

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

  • [2024-05-07 13:09:37]
  • 评测
  • 测评结果:WA
  • 用时:65ms
  • 内存:5672kb
  • [2024-05-07 13:09:35]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=2e3+5;
int n,MOD;
int d[N][N];
signed main(){
	scanf("%lld%lld",&n,&MOD);
	n=min(n,300*1ll);
	for(int i=1;i<=n;i++)d[0][i]=1;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			for(int k=1;k<=j;k++){
				if(i>=k)d[i][j]=(d[i][j]+d[i-k][j])%MOD;
			}
		}
	}
	int tot=0;
	for(int i=1;i<=n;i++){
		int ans=0;
		for(int j=1;j<=min(n,i);j++){
			ans=(ans+d[i-j][j])%MOD;
		}
		tot=(tot+ans)%MOD;
		cout<<tot<<" ";
	}
	cout<<"\n";
	return 0;
} 

详细

Test #1:

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

input:

5 1000000007

output:

1 3 6 11 19 

result:

ok 5 number(s): "1 3 6 11 19"

Test #2:

score: -100
Wrong Answer
time: 65ms
memory: 5672kb

input:

200000 567894337

output:

1 3 6 11 19 33 57 100 177 317 573 1045 1919 3547 6592 12311 23091 43479 82153 155715 295983 564049 1077399 2062310 3955185 7598755 14622317 28179337 54379519 105071497 203254163 393607533 195106662 344669981 35619335 477103886 79913732 147415830 329955039 273123672 546045352 337527455 443978690 4597...

result:

wrong answer Answer contains longer sequence [length = 200000], but output contains 300 elements