Submission #75887547
Source Code Expand
x1, x2, x3 = map(int, input().split())
MOD = 998244353
seq_len = x1 + x2 + x3
fact = [1] * seq_len
inv = [1] * seq_len
for i in range(1, seq_len):
fact[i] = (fact[i - 1] * i) % MOD
inv[seq_len - 1] = pow(fact[seq_len - 1], MOD - 2, MOD)
for i in range(seq_len - 2, -1, -1):
inv[i] = (inv[i + 1] * (i + 1)) % MOD
max_put = x2 + 1
ans = 0
for i in range(1, min(x1, max_put) + 1):
ways1_1 = ((fact[max_put] * inv[i] % MOD) * inv[max_put - i]) % MOD
ways1_2 = ((fact[x1 - 1] * inv[i - 1] % MOD) * inv[x1 - i]) % MOD
ways3 = 0
if max_put - i + x3 - 1 >= x3:
n_val = max_put - i + x3 - 1
ways3 = ((fact[n_val] * inv[x3] % MOD) * inv[n_val - x3]) % MOD
ans = (ans + ways1_1 * ways1_2 % MOD * ways3) % MOD
print(ans)
Submission Info
| Submission Time | |
|---|---|
| Task | E - Count 123 |
| User | gett |
| Language | Python (PyPy 3.11-v7.3.20) |
| Score | 450 |
| Code Size | 810 Byte |
| Status | AC |
| Exec Time | 114 ms |
| Memory | 135748 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 450 / 450 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt |
| All | 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt, 01-24.txt, 01-25.txt, 01-26.txt, 01-27.txt, 01-28.txt, 01-29.txt, 01-30.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00-sample-01.txt | AC | 45 ms | 79676 KiB |
| 00-sample-02.txt | AC | 45 ms | 79696 KiB |
| 00-sample-03.txt | AC | 109 ms | 135632 KiB |
| 01-01.txt | AC | 75 ms | 110920 KiB |
| 01-02.txt | AC | 63 ms | 99920 KiB |
| 01-03.txt | AC | 75 ms | 109168 KiB |
| 01-04.txt | AC | 67 ms | 102576 KiB |
| 01-05.txt | AC | 88 ms | 117992 KiB |
| 01-06.txt | AC | 75 ms | 107604 KiB |
| 01-07.txt | AC | 46 ms | 79692 KiB |
| 01-08.txt | AC | 110 ms | 135748 KiB |
| 01-09.txt | AC | 112 ms | 135192 KiB |
| 01-10.txt | AC | 114 ms | 135360 KiB |
| 01-11.txt | AC | 85 ms | 117484 KiB |
| 01-12.txt | AC | 84 ms | 117056 KiB |
| 01-13.txt | AC | 76 ms | 109020 KiB |
| 01-14.txt | AC | 72 ms | 106796 KiB |
| 01-15.txt | AC | 79 ms | 108888 KiB |
| 01-16.txt | AC | 64 ms | 98028 KiB |
| 01-17.txt | AC | 63 ms | 97944 KiB |
| 01-18.txt | AC | 71 ms | 105292 KiB |
| 01-19.txt | AC | 91 ms | 119736 KiB |
| 01-20.txt | AC | 87 ms | 116308 KiB |
| 01-21.txt | AC | 91 ms | 119768 KiB |
| 01-22.txt | AC | 69 ms | 100548 KiB |
| 01-23.txt | AC | 92 ms | 119552 KiB |
| 01-24.txt | AC | 80 ms | 110668 KiB |
| 01-25.txt | AC | 90 ms | 120104 KiB |
| 01-26.txt | AC | 83 ms | 113488 KiB |
| 01-27.txt | AC | 90 ms | 119740 KiB |
| 01-28.txt | AC | 67 ms | 99688 KiB |
| 01-29.txt | AC | 90 ms | 119748 KiB |
| 01-30.txt | AC | 81 ms | 111104 KiB |