結果
問題 | No.1706 Many Bus Stops (hard) |
ユーザー | Kiri8128 |
提出日時 | 2021-10-08 23:10:42 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 706 bytes |
コンパイル時間 | 284 ms |
コンパイル使用メモリ | 87,284 KB |
実行使用メモリ | 76,664 KB |
最終ジャッジ日時 | 2023-09-30 12:43:49 |
合計ジャッジ時間 | 5,478 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 75 ms
71,128 KB |
testcase_01 | AC | 74 ms
71,324 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 81 ms
76,256 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
ソースコード
def mmult(A, B): global mod n, m, l = len(A), len(B), len(B[0]) ret = [[0] * l for _ in range(n)] for i in range(n): for j in range(m): for k in range(l): ret[i][k] = (ret[i][k] + A[i][j] * B[j][k]) % mod return ret def mpow(A, n): if n == 1: return A if n == 0: return [[1 if i == j else 0 for j in range(len(A))] for i in range(len(A))] return mmult(mpow(A, n - 1), A) if n % 2 else mpow(mmult(A, A), n // 2) C, N, M = map(int, input().split()) mod = 10 ** 9 + 7 iv = pow(C, mod - 2, mod) ivv = iv * (C - 2) % mod X = [[iv, 0, 0, iv], [0, iv, iv, ivv], [1, 0, 0, 0], [0, 1, 0, 0]] print((1 - pow(1 - mpow(X, N)[0][0], M, mod)) % mod)