結果

問題 No.498 ワープクリスタル (給料日編)
ユーザー maspymaspy
提出日時 2020-03-05 15:48:17
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 687 bytes
コンパイル時間 180 ms
コンパイル使用メモリ 82,164 KB
実行使用メモリ 79,484 KB
最終ジャッジ日時 2024-04-22 02:35:09
合計ジャッジ時間 8,640 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,224 KB
testcase_01 AC 36 ms
51,840 KB
testcase_02 AC 33 ms
52,352 KB
testcase_03 AC 33 ms
52,352 KB
testcase_04 RE -
testcase_05 AC 34 ms
53,008 KB
testcase_06 WA -
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 580 ms
76,772 KB
testcase_10 AC 34 ms
52,096 KB
testcase_11 AC 141 ms
76,840 KB
testcase_12 AC 35 ms
52,608 KB
testcase_13 WA -
testcase_14 AC 39 ms
59,520 KB
testcase_15 AC 68 ms
76,544 KB
testcase_16 AC 43 ms
60,800 KB
testcase_17 AC 65 ms
76,368 KB
testcase_18 WA -
testcase_19 AC 609 ms
77,216 KB
testcase_20 WA -
testcase_21 AC 635 ms
77,176 KB
testcase_22 AC 624 ms
77,060 KB
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/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)
0