結果
問題 | No.1136 Four Points Tour |
ユーザー | hir355 |
提出日時 | 2020-08-01 23:36:05 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 27 ms / 2,000 ms |
コード長 | 557 bytes |
コンパイル時間 | 158 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-07-08 11:10:58 |
合計ジャッジ時間 | 2,434 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 25 ms
10,752 KB |
testcase_01 | AC | 25 ms
10,752 KB |
testcase_02 | AC | 26 ms
10,496 KB |
testcase_03 | AC | 27 ms
10,752 KB |
testcase_04 | AC | 26 ms
10,624 KB |
testcase_05 | AC | 26 ms
10,624 KB |
testcase_06 | AC | 26 ms
10,624 KB |
testcase_07 | AC | 24 ms
10,496 KB |
testcase_08 | AC | 24 ms
10,752 KB |
testcase_09 | AC | 25 ms
10,496 KB |
testcase_10 | AC | 25 ms
10,752 KB |
testcase_11 | AC | 26 ms
10,624 KB |
testcase_12 | AC | 25 ms
10,624 KB |
testcase_13 | AC | 25 ms
10,752 KB |
testcase_14 | AC | 24 ms
10,624 KB |
testcase_15 | AC | 24 ms
10,624 KB |
testcase_16 | AC | 24 ms
10,752 KB |
testcase_17 | AC | 25 ms
10,752 KB |
testcase_18 | AC | 25 ms
10,496 KB |
testcase_19 | AC | 26 ms
10,496 KB |
testcase_20 | AC | 25 ms
10,496 KB |
testcase_21 | AC | 25 ms
10,624 KB |
01_Sample03_evil.txt | AC | 26 ms
10,752 KB |
04_Rnd_large_evil1.txt | AC | 25 ms
10,624 KB |
04_Rnd_large_evil2.txt | AC | 25 ms
10,496 KB |
04_Rnd_large_evil3.txt | AC | 26 ms
10,752 KB |
04_Rnd_large_evil4.txt | AC | 25 ms
10,496 KB |
04_Rnd_large_evil5.txt | AC | 26 ms
10,496 KB |
04_Rnd_large_evil6.txt | AC | 25 ms
10,752 KB |
04_Rnd_large_evil7.txt | AC | 25 ms
10,496 KB |
04_Rnd_large_evil8.txt | AC | 25 ms
10,496 KB |
04_Rnd_large_evil9.txt | AC | 25 ms
10,496 KB |
04_Rnd_large_evil10.txt | AC | 24 ms
10,496 KB |
05_Rnd_huge_evil1.txt | AC | 25 ms
10,624 KB |
05_Rnd_huge_evil2.txt | AC | 25 ms
10,496 KB |
05_Rnd_huge_evil3.txt | AC | 25 ms
10,496 KB |
05_Rnd_huge_evil4.txt | AC | 25 ms
10,624 KB |
05_Rnd_huge_evil5.txt | AC | 26 ms
10,624 KB |
05_Rnd_huge_evil6.txt | AC | 25 ms
10,624 KB |
05_Rnd_huge_evil7.txt | AC | 25 ms
10,496 KB |
99_evil_01.txt | AC | 24 ms
10,496 KB |
ソースコード
MOD = 10 ** 9 + 7 def mult(A, B, N): C = [[0] * N for _ in range(N)] for i in range(N): for j in range(N): for k in range(N): C[i][j] += A[i][k] * B[k][j] C[i][j] %= MOD return C def mat_power(A, N, n): if n == 0: res = [[0] * N for _ in range(N)] for i in range(N): res[i][i] = 1 return res X = mat_power(A, N, n // 2) X = mult(X, X, N) return mult(A, X, N) if n & 1 else X n = int(input()) print(mat_power([[0, 1], [3, 2]], 2, n)[0][0])