結果
問題 | No.1136 Four Points Tour |
ユーザー | tcltk |
提出日時 | 2021-01-16 09:08:43 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,307 bytes |
コンパイル時間 | 758 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 89,344 KB |
最終ジャッジ日時 | 2024-11-27 08:45:31 |
合計ジャッジ時間 | 7,729 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | RE | - |
01_Sample03_evil.txt | RE | - |
04_Rnd_large_evil1.txt | RE | - |
04_Rnd_large_evil2.txt | RE | - |
04_Rnd_large_evil3.txt | RE | - |
04_Rnd_large_evil4.txt | RE | - |
04_Rnd_large_evil5.txt | RE | - |
04_Rnd_large_evil6.txt | RE | - |
04_Rnd_large_evil7.txt | RE | - |
04_Rnd_large_evil8.txt | RE | - |
04_Rnd_large_evil9.txt | RE | - |
04_Rnd_large_evil10.txt | RE | - |
05_Rnd_huge_evil1.txt | RE | - |
05_Rnd_huge_evil2.txt | RE | - |
05_Rnd_huge_evil3.txt | RE | - |
05_Rnd_huge_evil4.txt | RE | - |
05_Rnd_huge_evil5.txt | RE | - |
05_Rnd_huge_evil6.txt | RE | - |
05_Rnd_huge_evil7.txt | RE | - |
99_evil_01.txt | RE | - |
ソースコード
#region Header #!/usr/bin/env python3 # from typing import * import sys import io import math import collections import decimal import itertools from queue import PriorityQueue import bisect import heapq import numpy as np def input(): return sys.stdin.readline()[:-1] sys.setrecursionlimit(1000000) #endregion # _INPUT = """334 # """ # sys.stdin = io.StringIO(_INPUT) MOD = 1000000007 def main(): N = int(input()) # dp = [[0, 0, 0, 0] for _ in range(N+1)] # dp[0][0] = 1 # for i in range(1, N+1): # dp[i][0] = (dp[i-1][1] + dp[i-1][2] + dp[i-1][3]) % MOD # dp[i][1] = (dp[i-1][0] + dp[i-1][2] + dp[i-1][3]) % MOD # dp[i][2] = (dp[i-1][0] + dp[i-1][1] + dp[i-1][3]) % MOD # dp[i][3] = (dp[i-1][0] + dp[i-1][1] + dp[i-1][2]) % MOD # print(dp[N][0]) A = np.matrix([ [0, 1, 1, 1], [1, 0, 1, 1], [1, 1, 0, 1], [1, 1, 1, 0]], dtype=object) # A_N = np.linalg.matrix_power(A, N) M = A R = np.identity(4, dtype=object) while N > 0: if N & 1 > 0: R = (R * M) % MOD M = (M * M) % MOD N >>= 1 v = R * np.array([[1], [0], [0], [0]]) print(v.item(0, 0) % MOD) if __name__ == '__main__': main()