結果

問題 No.498 ワープクリスタル (給料日編)
ユーザー nebukuro09nebukuro09
提出日時 2017-03-24 23:19:21
言語 PyPy2
(7.3.13)
結果
AC  
実行時間 243 ms / 2,000 ms
コード長 570 bytes
コンパイル時間 2,013 ms
コンパイル使用メモリ 77,644 KB
実行使用メモリ 80,036 KB
最終ジャッジ日時 2023-09-20 03:44:45
合計ジャッジ時間 6,507 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
76,144 KB
testcase_01 AC 75 ms
76,288 KB
testcase_02 AC 74 ms
76,344 KB
testcase_03 AC 74 ms
76,196 KB
testcase_04 AC 230 ms
79,168 KB
testcase_05 AC 75 ms
76,180 KB
testcase_06 AC 230 ms
79,288 KB
testcase_07 AC 243 ms
80,036 KB
testcase_08 AC 227 ms
79,448 KB
testcase_09 AC 227 ms
79,048 KB
testcase_10 AC 74 ms
76,316 KB
testcase_11 AC 102 ms
79,012 KB
testcase_12 AC 73 ms
76,548 KB
testcase_13 AC 91 ms
79,000 KB
testcase_14 AC 74 ms
76,304 KB
testcase_15 AC 87 ms
79,064 KB
testcase_16 AC 76 ms
77,312 KB
testcase_17 AC 88 ms
79,288 KB
testcase_18 AC 228 ms
79,300 KB
testcase_19 AC 205 ms
79,600 KB
testcase_20 AC 205 ms
79,076 KB
testcase_21 AC 209 ms
79,228 KB
testcase_22 AC 204 ms
79,180 KB
testcase_23 AC 227 ms
79,116 KB
testcase_24 AC 225 ms
79,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

Gx, Gy, K = map(int, raw_input().split())
C = [[] for _ in xrange(K)]
for i in xrange(K):
    x, y, n = map(int, raw_input().split())
    for j in xrange(n+1):
        C[i].append((x*j, y*j, j))

F = [1 for _ in xrange(76)]
for i in xrange(1, 76):
    F[i] = F[i-1] * i

ans = 0
for p in itertools.product(*C):
    x, y = 0, 0
    a = []
    for i in p:
        x += i[0]
        y += i[1]
        a.append(i[2])
    if Gx == x and Gy == y:
        b = 1
        for aa in a:
            b *= F[aa]
        ans += F[sum(a)] / b

print ans % 1000000007
0