QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#619814 | #8149. Station of Fate | Pepinot | WA | 1ms | 4488kb | C++20 | 623b | 2024-10-07 15:32:11 | 2024-10-07 15:32:12 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
const int mod=998244353;
ll an[100005];
void ope() {
an[0]=1;
for(int i=1; i<=100000; i++)
an[i]=1ll*an[i-1]*i%mod;
}
signed main() {
ios::sync_with_stdio(false),cin.tie(nullptr);
ope();
// cout<<an[100000]<<endl;
int t; cin>>t;
while(t--) {
ll n,m; cin>>n>>m;
ll ans1=1ll*an[n-1]*an[n];
ll ans2=an[m-1]*an[n-m]%mod;
// ll ans2=1ll*an[n]/an[n-m]%mod;
// cout<<ans1<<" "<<ans2<<endl;
cout<<(ans1/ans2)%mod<<endl;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 4416kb
input:
2 3 2 6 3
output:
12 7200
result:
ok 2 lines
Test #2:
score: 0
Accepted
time: 1ms
memory: 4344kb
input:
4 6 5 2 2 7 5 1 1
output:
3600 2 75600 1
result:
ok 4 lines
Test #3:
score: 0
Accepted
time: 1ms
memory: 4396kb
input:
8 10 3 3 3 4 4 9 7 8 2 6 4 7 2 2 2
output:
130636800 6 24 10160640 282240 7200 30240 2
result:
ok 8 lines
Test #4:
score: 0
Accepted
time: 0ms
memory: 4416kb
input:
2 3 3 1 1
output:
6 1
result:
ok 2 lines
Test #5:
score: 0
Accepted
time: 0ms
memory: 4428kb
input:
6 3 1 9 2 6 4 5 5 8 1 8 4
output:
6 2903040 7200 120 40320 1411200
result:
ok 6 lines
Test #6:
score: 0
Accepted
time: 1ms
memory: 4432kb
input:
4 7 1 6 6 3 3 3 2
output:
5040 720 6 12
result:
ok 4 lines
Test #7:
score: 0
Accepted
time: 1ms
memory: 4460kb
input:
8 2 1 10 6 7 6 1 1 7 2 1 1 2 1 7 1
output:
2 457228800 30240 1 30240 1 2 5040
result:
ok 8 lines
Test #8:
score: 0
Accepted
time: 1ms
memory: 4352kb
input:
2 6 5 8 4
output:
3600 1411200
result:
ok 2 lines
Test #9:
score: 0
Accepted
time: 1ms
memory: 4472kb
input:
6 1 1 5 1 1 1 7 1 1 1 4 1
output:
1 120 1 5040 1 24
result:
ok 6 lines
Test #10:
score: 0
Accepted
time: 0ms
memory: 4360kb
input:
4 3 3 7 2 6 5 5 5
output:
6 30240 3600 120
result:
ok 4 lines
Test #11:
score: 0
Accepted
time: 1ms
memory: 4488kb
input:
8 7 7 3 2 10 5 7 3 2 2 2 1 8 7 9 2
output:
5040 12 457228800 75600 2 2 282240 2903040
result:
ok 8 lines
Test #12:
score: 0
Accepted
time: 1ms
memory: 4360kb
input:
3 5 5 7 2 7 5
output:
120 30240 75600
result:
ok 3 lines
Test #13:
score: 0
Accepted
time: 1ms
memory: 4344kb
input:
7 6 6 10 9 6 2 3 2 6 1 5 1 8 5
output:
720 32659200 3600 12 720 120 1411200
result:
ok 7 lines
Test #14:
score: 0
Accepted
time: 0ms
memory: 4416kb
input:
5 10 8 2 1 8 3 1 1 9 5
output:
130636800 2 846720 1 25401600
result:
ok 5 lines
Test #15:
score: 0
Accepted
time: 0ms
memory: 4352kb
input:
5 4 2 10 7 5 2 5 1 7 3
output:
72 304819200 480 120 75600
result:
ok 5 lines
Test #16:
score: 0
Accepted
time: 1ms
memory: 4352kb
input:
3 5 2 3 2 10 10
output:
480 12 3628800
result:
ok 3 lines
Test #17:
score: 0
Accepted
time: 1ms
memory: 4424kb
input:
7 1 1 1 1 7 3 5 2 5 3 4 3 3 1
output:
1 1 75600 480 720 72 6
result:
ok 7 lines
Test #18:
score: 0
Accepted
time: 1ms
memory: 4428kb
input:
5 1 1 2 1 8 8 3 3 4 1
output:
1 2 40320 6 24
result:
ok 5 lines
Test #19:
score: 0
Accepted
time: 1ms
memory: 4352kb
input:
5 6 4 10 3 2 2 1 1 6 3
output:
7200 130636800 2 1 7200
result:
ok 5 lines
Test #20:
score: -100
Wrong Answer
time: 1ms
memory: 4348kb
input:
8 52 4 68 41 82 17 73 15 44 25 84 34 81 23 59 57
output:
291032828 120735375 1608968 22799922 416408250 248076496 707555 978827285
result:
wrong answer 1st lines differ - expected: '39982437', found: '291032828'