QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#47175#4623. Matryoshka DollYeruihuaWA 89ms101516kbC++906b2022-09-04 15:07:462022-09-04 15:07:47

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-09-04 15:07:47]
  • 评测
  • 测评结果:WA
  • 用时:89ms
  • 内存:101516kb
  • [2022-09-04 15:07:46]
  • 提交

answer

#include <bits/stdc++.h>
#define N  5005
#define IO ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define mod 998244353
using namespace std;

int dp[N][N];
int a[N];
int cnt[N];
int T,n;

int main()
{
    IO;
    cin>>T;
    while(T--){
        int r,k;
        cin>>n>>k>>r;
        for(int i=1; i<=n; i++){
            cin>>a[i];
        }
        int nowp=0;
        for(int i=1; i<=n; i++){
            while(a[nowp+1]+r<=a[i])   nowp++;
            cnt[i] = nowp;
        }
        dp[0][0] = 1;
        for(int i=1; i<=n; i++){
            for(int j=i-cnt[i]; j<=k; j++){
                dp[i][j] = (dp[i-1][j-1] + dp[i-1][j] * (j-(i-cnt[i]-1)))% mod;
            }
        }
        cout<<dp[n][k]<<endl;
        for(int i=1; i<=n; i++){
            for(int j=1; j<=k; j++){
                dp[i][j] = 0;
            }
        }
    }
    return 0;
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 89ms
memory: 101516kb

input:

20
4 3 2
1 2 3 4
4 2 1
1 1 2 2
10 3 5
7 20 27 27 34 36 40 56 63 98
10 5 10
5 6 11 20 34 39 42 57 86 99
100 2 4
61 139 210 338 426 591 614 637 658 678 699 1002 1015 1162 1424 1433 1502 1756 1994 2073 2164 2189 2258 2305 2460 2464 2497 2507 2512 2526 2557 2742 2794 2809 3060 3075 3201 3226 3380 3576 3...

output:

3
2
2852
10554
719747106
-275148355
876167311
128518553
-22296179
-450001397
835252299
-885173374
1
927604200
0
-584856698
732537998
1
-700667535
1

result:

wrong answer 6th lines differ - expected: '690165012', found: '-275148355'