結果

問題 No.1136 Four Points Tour
ユーザー McGregorshMcGregorsh
提出日時 2022-07-11 15:08:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 271 ms / 2,000 ms
コード長 1,748 bytes
コンパイル時間 944 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 123,484 KB
最終ジャッジ日時 2023-09-03 23:46:37
合計ジャッジ時間 20,829 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 237 ms
91,912 KB
testcase_01 AC 241 ms
92,048 KB
testcase_02 AC 237 ms
92,060 KB
testcase_03 AC 237 ms
91,880 KB
testcase_04 AC 235 ms
92,080 KB
testcase_05 AC 236 ms
92,048 KB
testcase_06 AC 237 ms
91,908 KB
testcase_07 AC 259 ms
106,192 KB
testcase_08 AC 232 ms
92,092 KB
testcase_09 AC 236 ms
92,100 KB
testcase_10 AC 266 ms
114,184 KB
testcase_11 AC 240 ms
92,832 KB
testcase_12 AC 249 ms
95,336 KB
testcase_13 AC 236 ms
92,056 KB
testcase_14 AC 241 ms
94,504 KB
testcase_15 AC 237 ms
92,616 KB
testcase_16 AC 245 ms
95,124 KB
testcase_17 AC 238 ms
95,764 KB
testcase_18 AC 256 ms
109,132 KB
testcase_19 AC 271 ms
123,484 KB
testcase_20 AC 246 ms
93,440 KB
testcase_21 AC 263 ms
109,236 KB
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 MLE -
04_Rnd_large_evil5.txt RE -
04_Rnd_large_evil6.txt RE -
04_Rnd_large_evil7.txt RE -
04_Rnd_large_evil8.txt MLE -
04_Rnd_large_evil9.txt RE -
04_Rnd_large_evil10.txt MLE -
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 -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, re
from fractions import Fraction
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque, defaultdict
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement, permutations
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
def get_distance(x1, y1, x2, y2):
	  d = sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
	  return d
def rotate(table):
   	  n_fild = []
   	  for x in zip(*table[::-1]):
   	  	  n_fild.append(x)
   	  return n_fild
sys.setrecursionlimit(10 ** 7)
INF = float('inf')
MOD = 10 ** 9 + 7
MOD2 = 998244353


###関数コピーしたか?###
def main():
   
   n = int(input())
   
   A = [0] * n
   B = [0] * n
   C = [0] * n
   D = [0] * n
   A[0] = 1
   
   for i in range(n-1):
   	  A[i+1] = B[i] + C[i] + D[i]
   	  A[i+1] %= MOD
   	  B[i+1] = A[i] + C[i] + D[i]
   	  B[i+1] %= MOD
   	  C[i+1] = A[i] + B[i] + D[i]
   	  C[i+1] %= MOD
   	  D[i+1] = A[i] + B[i] + C[i]
   	  C[i+1] %= MOD
   
   print((B[-1] + C[-1] + D[-1]) % MOD)
   
if __name__ == '__main__':
    main()

0