結果
問題 | No.1112 冥界の音楽 |
ユーザー | mkawa2 |
提出日時 | 2020-07-10 22:40:48 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 968 bytes |
コンパイル時間 | 87 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 49,504 KB |
最終ジャッジ日時 | 2024-04-19 17:54:06 |
合計ジャッジ時間 | 23,017 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 443 ms
49,504 KB |
testcase_01 | AC | 451 ms
44,028 KB |
testcase_02 | AC | 459 ms
44,004 KB |
testcase_03 | AC | 456 ms
44,008 KB |
testcase_04 | AC | 450 ms
44,128 KB |
testcase_05 | AC | 436 ms
43,772 KB |
testcase_06 | AC | 575 ms
43,640 KB |
testcase_07 | AC | 444 ms
43,772 KB |
testcase_08 | AC | 443 ms
43,752 KB |
testcase_09 | AC | 451 ms
44,252 KB |
testcase_10 | AC | 447 ms
43,768 KB |
testcase_11 | AC | 460 ms
43,740 KB |
testcase_12 | AC | 436 ms
44,256 KB |
testcase_13 | AC | 449 ms
43,616 KB |
testcase_14 | TLE | - |
testcase_15 | AC | 639 ms
43,624 KB |
testcase_16 | AC | 450 ms
43,736 KB |
testcase_17 | AC | 927 ms
44,384 KB |
testcase_18 | AC | 914 ms
43,740 KB |
testcase_19 | AC | 440 ms
43,620 KB |
testcase_20 | AC | 526 ms
43,996 KB |
testcase_21 | AC | 1,873 ms
43,876 KB |
testcase_22 | TLE | - |
testcase_23 | AC | 790 ms
43,744 KB |
testcase_24 | AC | 452 ms
43,744 KB |
testcase_25 | AC | 454 ms
44,380 KB |
testcase_26 | AC | 458 ms
43,736 KB |
testcase_27 | AC | 449 ms
44,004 KB |
testcase_28 | AC | 464 ms
43,764 KB |
testcase_29 | AC | 445 ms
44,128 KB |
testcase_30 | AC | 1,959 ms
44,020 KB |
testcase_31 | AC | 465 ms
43,740 KB |
testcase_32 | AC | 1,999 ms
43,736 KB |
testcase_33 | AC | 448 ms
44,260 KB |
testcase_34 | AC | 446 ms
43,620 KB |
testcase_35 | AC | 441 ms
44,120 KB |
testcase_36 | TLE | - |
ソースコード
import numpy as np import sys def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def main(n): if n == 3: ans = 0 for p, q, r in pqr: if p == 1 and r == 1: ans += 1 print(ans) exit() start = [] end = [] to = np.zeros((m, m), dtype=object) for i in range(m): if pqr[i][0] == 1: start.append(i) if pqr[i][2] == 1: end.append(i) for j in range(m): if pqr[i][1:] == pqr[j][:2]: to[i][j] = 1 # print(to) cnt = np.eye(m, dtype=object) n -= 3 while n: if n & 1: cnt = np.dot(cnt, to) % md to = np.dot(to, to) % md n >>= 1 # print(cnt) ans = 0 for s in start: for e in end: ans += cnt[s][e] ans %= md print(ans) md=10**9+7 k,m,n=MI() pqr=LLI(m) main(n)