結果
| 問題 |
No.498 ワープクリスタル (給料日編)
|
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-03-05 15:48:17 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 687 bytes |
| コンパイル時間 | 587 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 79,264 KB |
| 最終ジャッジ日時 | 2024-10-14 01:17:26 |
| 合計ジャッジ時間 | 10,929 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 12 WA * 6 RE * 3 |
ソースコード
#!/usr/bin/env python3
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import itertools
# %%
Gx, Gy, K = map(int, readline().split())
m = map(int, read().split())
XYN = list(zip(m, m, m))
# %%
fact = [1] * 50
for n in range(1, 50):
fact[n] = n * fact[n - 1]
# %%
X, Y, N = zip(*XYN)
rngs = [range(n + 1) for n in N]
it = itertools.product(*rngs)
answer = 0
for p in it:
x = sum(dx * cnt for dx, cnt in zip(X, p))
y = sum(dy * cnt for dy, cnt in zip(Y, p))
if x != Gx or y != Gy:
continue
x = fact[sum(p)]
for cnt in p:
x //= fact[cnt]
answer += x
# %%
print(answer)
maspy