結果
| 問題 |
No.2033 Chromatic Duel
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 16:58:57 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,412 bytes |
| コンパイル時間 | 273 ms |
| コンパイル使用メモリ | 81,860 KB |
| 実行使用メモリ | 75,600 KB |
| 最終ジャッジ日時 | 2025-06-12 16:59:03 |
| 合計ジャッジ時間 | 3,671 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 3 |
| other | AC * 5 WA * 32 |
ソースコード
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
X = N - W
sum_overlap = 3 * B - X
if sum_overlap < 0 or sum_overlap > B - 1:
print(0)
return
if (sum_overlap) % 1 != 0:
print(0)
return
sum_overlap = int(sum_overlap)
if sum_overlap < 0 or sum_overlap > B - 1:
print(0)
return
if B == 1:
if X == 3:
print(2)
else:
print(0)
return
from math import comb
total = 0
if sum_overlap == 0:
if 3 * B == X:
a = B - 1
required = 3 * B
total = comb(N - (3 * B - 1), B)
else:
required_blocks = 3 * B - sum_overlap
if required_blocks != X:
print(0)
return
if (B - 1 - sum_overlap) < 0:
print(0)
return
m = sum_overlap
need = m
places = B + 1
gaps = B - 1
min_length = 3 * (B - 1) - m + 1
if min_length > N:
print(0)
return
available = N - min_length + 1
if available < 0:
print(0)
return
total = comb(available + places - 1, places - 1)
print(total % MOD)
if __name__ == '__main__':
main()
gew1fw