結果

問題 No.498 ワープクリスタル (給料日編)
ユーザー titiatitia
提出日時 2023-06-29 00:13:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,996 ms / 2,000 ms
コード長 1,239 bytes
コンパイル時間 394 ms
コンパイル使用メモリ 86,896 KB
実行使用メモリ 200,272 KB
最終ジャッジ日時 2023-09-19 05:06:10
合計ジャッジ時間 26,397 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 99 ms
85,232 KB
testcase_01 AC 105 ms
85,016 KB
testcase_02 AC 101 ms
85,184 KB
testcase_03 AC 99 ms
85,068 KB
testcase_04 AC 1,715 ms
191,568 KB
testcase_05 AC 108 ms
85,268 KB
testcase_06 AC 1,927 ms
196,604 KB
testcase_07 AC 1,816 ms
193,592 KB
testcase_08 AC 1,991 ms
200,272 KB
testcase_09 AC 1,728 ms
191,100 KB
testcase_10 AC 99 ms
85,204 KB
testcase_11 AC 556 ms
100,928 KB
testcase_12 AC 100 ms
85,192 KB
testcase_13 AC 248 ms
93,328 KB
testcase_14 AC 103 ms
85,344 KB
testcase_15 AC 124 ms
86,096 KB
testcase_16 AC 103 ms
85,140 KB
testcase_17 AC 128 ms
86,300 KB
testcase_18 AC 1,844 ms
195,768 KB
testcase_19 AC 1,772 ms
193,416 KB
testcase_20 AC 1,778 ms
193,776 KB
testcase_21 AC 1,912 ms
197,432 KB
testcase_22 AC 1,734 ms
191,084 KB
testcase_23 AC 1,909 ms
197,464 KB
testcase_24 AC 1,996 ms
197,564 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

Gx,Gy,K=map(int,input().split())
W=[list(map(int,input().split())) for i in range(K)]

while len(W)<=5:
    W.append((0,0,0))

DP=[[[[[0]*16 for i in range(16)] for j in range(16)] for k in range(16)] for l in range(16)]
DP[0][0][0][0][0]=1

ANS=0

for i in range(W[0][2]+1):
    for j in range(W[1][2]+1):
        for k in range(W[2][2]+1):
            for l in range(W[3][2]+1):
                for m in range(W[4][2]+1):

                    if i+1<=W[0][2]:
                        DP[i+1][j][k][l][m]+=DP[i][j][k][l][m]
                        
                    if j+1<=W[1][2]:
                        DP[i][j+1][k][l][m]+=DP[i][j][k][l][m]

                    if k+1<=W[2][2]:        
                        DP[i][j][k+1][l][m]+=DP[i][j][k][l][m]
                        
                    if l+1<=W[3][2]:
                        DP[i][j][k][l+1][m]+=DP[i][j][k][l][m]

                    if m+1<=W[4][2]:
                        DP[i][j][k][l][m+1]+=DP[i][j][k][l][m]

                    x=W[0][0]*i+W[1][0]*j+W[2][0]*k+W[3][0]*l+W[4][0]*m
                    y=W[0][1]*i+W[1][1]*j+W[2][1]*k+W[3][1]*l+W[4][1]*m

                    if x==Gx and y==Gy:
                        ANS+=DP[i][j][k][l][m]

print(ANS%(10**9+7))
0