結果

問題 No.1136 Four Points Tour
ユーザー McGregorshMcGregorsh
提出日時 2022-07-11 15:08:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 165 ms / 2,000 ms
コード長 1,748 bytes
コンパイル時間 220 ms
コンパイル使用メモリ 82,212 KB
実行使用メモリ 120,476 KB
最終ジャッジ日時 2024-06-13 04:18:47
合計ジャッジ時間 11,394 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
89,436 KB
testcase_01 AC 129 ms
89,332 KB
testcase_02 AC 130 ms
89,520 KB
testcase_03 AC 127 ms
89,528 KB
testcase_04 AC 129 ms
89,368 KB
testcase_05 AC 130 ms
89,572 KB
testcase_06 AC 126 ms
88,952 KB
testcase_07 AC 152 ms
103,176 KB
testcase_08 AC 125 ms
89,420 KB
testcase_09 AC 127 ms
89,552 KB
testcase_10 AC 157 ms
111,056 KB
testcase_11 AC 134 ms
89,788 KB
testcase_12 AC 136 ms
91,584 KB
testcase_13 AC 128 ms
89,316 KB
testcase_14 AC 137 ms
90,624 KB
testcase_15 AC 140 ms
89,736 KB
testcase_16 AC 140 ms
90,812 KB
testcase_17 AC 136 ms
91,988 KB
testcase_18 AC 154 ms
106,136 KB
testcase_19 AC 165 ms
120,476 KB
testcase_20 AC 137 ms
89,768 KB
testcase_21 AC 153 ms
106,100 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