Submission #37454568
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
int f[3010][3010];
signed main() {
int a,b,c,d;
cin>>a>>b>>c>>d;
f[a][b]=1;
for(int i=a;i<=c;i++)
for(int j=b;j<=d;j++) {
if(i==a&&j==b) continue;
f[i][j]=(1ll*f[i-1][j]*j%mod+1ll*f[i][j-1]*i%mod-1ll*f[i-1][j-1]*(i-1)%mod*(j-1)%mod+mod)%mod;
}
cout<<f[c][d]<<endl;
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Extension |
| User | cxm1024 |
| Language | C++ (GCC 9.2.1) |
| Score | 600 |
| Code Size | 377 Byte |
| Status | AC |
| Exec Time | 116 ms |
| Memory | 38840 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 600 / 600 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | s1.txt, s2.txt, s3.txt |
| All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, s1.txt, s2.txt, s3.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 01.txt | AC | 116 ms | 38840 KiB |
| 02.txt | AC | 89 ms | 30952 KiB |
| 03.txt | AC | 2 ms | 3508 KiB |
| 04.txt | AC | 1 ms | 3376 KiB |
| 05.txt | AC | 13 ms | 12836 KiB |
| 06.txt | AC | 2 ms | 3392 KiB |
| 07.txt | AC | 35 ms | 14580 KiB |
| 08.txt | AC | 23 ms | 12276 KiB |
| 09.txt | AC | 2 ms | 3568 KiB |
| 10.txt | AC | 37 ms | 16160 KiB |
| 11.txt | AC | 5 ms | 4344 KiB |
| 12.txt | AC | 3 ms | 4120 KiB |
| 13.txt | AC | 48 ms | 21508 KiB |
| 14.txt | AC | 18 ms | 15328 KiB |
| s1.txt | AC | 2 ms | 3508 KiB |
| s2.txt | AC | 2 ms | 3524 KiB |
| s3.txt | AC | 3 ms | 3672 KiB |