QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#406510 | #8543. Periodic Sequence | xiaolang | WA | 319ms | 50584kb | C++14 | 534b | 2024-05-07 13:05:43 | 2024-05-07 13:05:44 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=2e6+5;
int n,MOD;
int d[N][30];
signed main(){
scanf("%lld%lld",&n,&MOD);
for(int i=1;i<=26;i++)d[0][i]=1;
for(int i=1;i<=n;i++){
for(int j=1;j<=26;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(26*1ll,i);j++){
ans=(ans+d[i-j][j])%MOD;
}
tot=(tot+ans)%MOD;
cout<<tot<<" ";
}
cout<<"\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3748kb
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: 319ms
memory: 50584kb
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 14622316 28179334 54379512 105071482 203254132 393607470 195106535 344669726 35618824 477102863 79911685 147411735 329946848 273107289 546012585 337461920 443847619 4571...
result:
wrong answer 27th numbers differ - expected: '14622317', found: '14622316'