結果
| 問題 |
No.2033 Chromatic Duel
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 17:05:56 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,257 bytes |
| コンパイル時間 | 189 ms |
| コンパイル使用メモリ | 82,004 KB |
| 実行使用メモリ | 54,140 KB |
| 最終ジャッジ日時 | 2025-06-12 17:06:00 |
| 合計ジャッジ時間 | 3,218 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 3 |
| other | AC * 7 WA * 30 |
ソースコード
MOD = 998244353
def main():
import sys
N, B, W = map(int, sys.stdin.readline().split())
if B == 0:
if W == 0:
print(1)
else:
print(0)
return
S = W + 3 * B - N
if S < 0 or S > 2:
print(0)
return
from math import comb
ans = 0
# Case 1: t1 = 0, t2 = 0, S=0
if S == 0:
# All B black positions are between 2 and N-1
# Available positions: M = N-2
M = N - 2
if M < B:
pass
else:
ans = (ans + comb(M, B)) % MOD
# Case 2: S=1, possible (t1, t2) = (0,1) or (1,0)
if S == 1:
# (t1, t2) = (0,1)
# One black at N, others between 2 and N-1
M = N - 2
if (B - 1) <= M:
ans = (ans + comb(M, B-1)) % MOD
# (t1, t2) = (1, 0)
M = N - 2
if (B - 1) <= M:
ans = (ans + comb(M, B-1)) % MOD
# Case 3: S=2, (t1, t2)=(1,1)
if S == 2:
# Both 1 and N are selected
if B < 2:
pass
else:
M = N - 2
if (B - 2) <= M:
ans = (ans + comb(M, B-2)) % MOD
print(ans % MOD)
if __name__ == "__main__":
main()
gew1fw