QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#750806 | #6199. 数圈圈 | jinqihao2023 | 0 | 3ms | 5908kb | C++14 | 601b | 2024-11-15 16:02:05 | 2024-11-15 16:02:06 |
answer
#include<bits/stdc++.h>
using namespace std;
const int N=5e3+5,mod=998244383;
int n,x,f[N][N],a[N],ans[N];
int main()
{
scanf("%d %d",&n,&x);
bool fl1=1;
for(int i=1;i<=n;i++)scanf("%d",&a[i]);
for(int i=1;i<n;i++)fl1&=(a[i]<=a[i+1]);
if(fl1)
{
f[0][0]=1;
for(int i=1;i<=n;i++)for(int j=0;j<=i;j++)
{
f[i][j]=f[i-1][j];
if(j>0)
{
if(a[i]>=i)f[i][j]=(f[i][j]+1ll*f[i-1][j-1]*(a[i]-j+x))%mod;
else f[i][j]=(f[i][j]+1ll*f[i-1][j-1]*max(0,a[i]-j+1))%mod;
}
}
for(int i=0;i<=n;i++)printf("%d ",f[n][i]);printf("\n");
return 0;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 1
Accepted
time: 0ms
memory: 3780kb
input:
1 915080344 1
output:
1 915080344
result:
ok 2 number(s): "1 915080344"
Test #2:
score: 1
Accepted
time: 0ms
memory: 3920kb
input:
1 915080344 0
output:
1 0
result:
ok 2 number(s): "1 0"
Test #3:
score: 0
Wrong Answer
time: 0ms
memory: 3928kb
input:
8 60641044 8 8 8 8 8 8 8 8
output:
1 485128408 946577857 890557670 141454420 160901800 789577502 434104053 4805909
result:
wrong answer 3rd numbers differ - expected: '47996075', found: '946577857'
Subtask #2:
score: 0
Wrong Answer
Test #8:
score: 0
Wrong Answer
time: 1ms
memory: 5908kb
input:
15 0 1 1 1 3 6 8 10 11 11 12 13 13 14 15 15
output:
1 122 6222 173976 2941896 31329936 212468976 908747712 384836930 634979235 959428034 118389217 151372800 4147200 0 0
result:
wrong answer 9th numbers differ - expected: '384836990', found: '384836930'
Subtask #3:
score: 0
Skipped
Dependency #1:
0%
Subtask #4:
score: 0
Runtime Error
Test #19:
score: 0
Runtime Error
input:
74999 1 1 2 3 3 4 4 4 4 4 4 4 4 7 8 8 9 9 9 10 13 13 14 14 16 19 20 21 22 24 25 25 26 26 29 31 32 32 35 35 36 38 39 39 40 41 43 43 44 45 45 45 46 48 49 50 50 50 51 53 54 57 59 59 60 60 62 63 63 65 66 69 71 73 76 78 78 78 79 79 79 80 81 81 81 82 82 83 83 85 87 89 91 94 94 94 94 98 99 99 100 100 101 1...
output:
result:
Subtask #5:
score: 0
Skipped
Dependency #1:
0%
Subtask #6:
score: 0
Wrong Answer
Test #28:
score: 0
Wrong Answer
time: 0ms
memory: 3620kb
input:
15 0 15 15 15 13 13 13 12 10 10 9 9 6 6 4 2
output:
result:
wrong answer Answer contains longer sequence [length = 16], but output contains 0 elements
Subtask #7:
score: 0
Skipped
Dependency #6:
0%
Subtask #8:
score: 0
Wrong Answer
Test #38:
score: 0
Wrong Answer
time: 3ms
memory: 4068kb
input:
74999 604849250 72634 60382 41531 20689 20667 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
result:
wrong answer Answer contains longer sequence [length = 75000], but output contains 0 elements
Subtask #9:
score: 0
Skipped
Dependency #6:
0%