結果
問題 | No.1136 Four Points Tour |
ユーザー | brthyyjp |
提出日時 | 2020-10-18 14:58:42 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 45 ms / 2,000 ms |
コード長 | 615 bytes |
コンパイル時間 | 455 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 60,160 KB |
最終ジャッジ日時 | 2024-07-21 04:47:39 |
合計ジャッジ時間 | 3,385 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 35 ms
51,840 KB |
testcase_01 | AC | 37 ms
52,224 KB |
testcase_02 | AC | 37 ms
51,968 KB |
testcase_03 | AC | 35 ms
52,096 KB |
testcase_04 | AC | 34 ms
51,968 KB |
testcase_05 | AC | 34 ms
51,840 KB |
testcase_06 | AC | 34 ms
51,968 KB |
testcase_07 | AC | 43 ms
59,648 KB |
testcase_08 | AC | 36 ms
52,096 KB |
testcase_09 | AC | 35 ms
52,352 KB |
testcase_10 | AC | 43 ms
60,160 KB |
testcase_11 | AC | 40 ms
58,624 KB |
testcase_12 | AC | 42 ms
59,520 KB |
testcase_13 | AC | 37 ms
52,096 KB |
testcase_14 | AC | 42 ms
59,648 KB |
testcase_15 | AC | 40 ms
58,752 KB |
testcase_16 | AC | 45 ms
59,904 KB |
testcase_17 | AC | 45 ms
59,392 KB |
testcase_18 | AC | 45 ms
59,520 KB |
testcase_19 | AC | 43 ms
59,520 KB |
testcase_20 | AC | 42 ms
59,648 KB |
testcase_21 | AC | 43 ms
59,520 KB |
01_Sample03_evil.txt | AC | 46 ms
60,800 KB |
04_Rnd_large_evil1.txt | AC | 44 ms
60,288 KB |
04_Rnd_large_evil2.txt | AC | 44 ms
60,032 KB |
04_Rnd_large_evil3.txt | AC | 44 ms
60,032 KB |
04_Rnd_large_evil4.txt | AC | 46 ms
60,160 KB |
04_Rnd_large_evil5.txt | AC | 44 ms
60,160 KB |
04_Rnd_large_evil6.txt | AC | 45 ms
60,544 KB |
04_Rnd_large_evil7.txt | AC | 46 ms
60,160 KB |
04_Rnd_large_evil8.txt | AC | 45 ms
60,160 KB |
04_Rnd_large_evil9.txt | AC | 44 ms
60,160 KB |
04_Rnd_large_evil10.txt | AC | 44 ms
60,288 KB |
05_Rnd_huge_evil1.txt | AC | 45 ms
60,288 KB |
05_Rnd_huge_evil2.txt | AC | 43 ms
60,288 KB |
05_Rnd_huge_evil3.txt | AC | 45 ms
60,544 KB |
05_Rnd_huge_evil4.txt | AC | 46 ms
60,288 KB |
05_Rnd_huge_evil5.txt | AC | 44 ms
60,672 KB |
05_Rnd_huge_evil6.txt | AC | 45 ms
60,160 KB |
05_Rnd_huge_evil7.txt | AC | 47 ms
61,312 KB |
99_evil_01.txt | AC | 43 ms
60,416 KB |
ソースコード
n = int(input()) mod = 10**9+7 # A*B def mul(a, b): c = [[0]*len(b[0]) for i in range(len(a))] for i in range(len(a)): for k in range(len(b)): for j in range(len(b[0])): c[i][j] = (c[i][j] + a[i][k]*b[k][j])%mod return c #A**n def pow(a, n): b = [[0]*len(a) for i in range(len(a))] for i in range(len(a)): b[i][i] = 1 while n > 0: if n & 1 == 1: b = mul(a, b) a = mul(a, a) n = n>>1 return b A = [[1]*4 for i in range(4)] for i in range(4): A[i][i] = 0 An = pow(A, n) ans = An[0][0] print(ans%mod)