結果
問題 | No.1136 Four Points Tour |
ユーザー | tonnnura172 |
提出日時 | 2020-08-10 20:09:33 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 593 ms / 2,000 ms |
コード長 | 1,130 bytes |
コンパイル時間 | 90 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 44,464 KB |
最終ジャッジ日時 | 2024-10-08 10:59:21 |
合計ジャッジ時間 | 23,964 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 473 ms
44,464 KB |
testcase_01 | AC | 464 ms
44,084 KB |
testcase_02 | AC | 479 ms
44,076 KB |
testcase_03 | AC | 489 ms
44,204 KB |
testcase_04 | AC | 477 ms
44,212 KB |
testcase_05 | AC | 472 ms
43,952 KB |
testcase_06 | AC | 476 ms
44,084 KB |
testcase_07 | AC | 466 ms
43,948 KB |
testcase_08 | AC | 461 ms
44,184 KB |
testcase_09 | AC | 460 ms
44,208 KB |
testcase_10 | AC | 476 ms
44,212 KB |
testcase_11 | AC | 467 ms
44,460 KB |
testcase_12 | AC | 462 ms
43,948 KB |
testcase_13 | AC | 479 ms
44,084 KB |
testcase_14 | AC | 484 ms
44,212 KB |
testcase_15 | AC | 498 ms
44,208 KB |
testcase_16 | AC | 479 ms
44,080 KB |
testcase_17 | AC | 484 ms
44,084 KB |
testcase_18 | AC | 466 ms
43,956 KB |
testcase_19 | AC | 472 ms
44,084 KB |
testcase_20 | AC | 593 ms
44,204 KB |
testcase_21 | AC | 577 ms
44,084 KB |
01_Sample03_evil.txt | AC | 536 ms
44,208 KB |
04_Rnd_large_evil1.txt | AC | 470 ms
44,208 KB |
04_Rnd_large_evil2.txt | AC | 481 ms
44,208 KB |
04_Rnd_large_evil3.txt | AC | 471 ms
44,084 KB |
04_Rnd_large_evil4.txt | AC | 480 ms
44,332 KB |
04_Rnd_large_evil5.txt | AC | 495 ms
44,084 KB |
04_Rnd_large_evil6.txt | AC | 457 ms
44,076 KB |
04_Rnd_large_evil7.txt | AC | 466 ms
44,204 KB |
04_Rnd_large_evil8.txt | AC | 461 ms
44,084 KB |
04_Rnd_large_evil9.txt | AC | 468 ms
44,208 KB |
04_Rnd_large_evil10.txt | AC | 460 ms
44,084 KB |
05_Rnd_huge_evil1.txt | AC | 465 ms
44,076 KB |
05_Rnd_huge_evil2.txt | AC | 463 ms
44,212 KB |
05_Rnd_huge_evil3.txt | AC | 456 ms
44,080 KB |
05_Rnd_huge_evil4.txt | AC | 465 ms
44,464 KB |
05_Rnd_huge_evil5.txt | AC | 470 ms
44,204 KB |
05_Rnd_huge_evil6.txt | AC | 468 ms
44,204 KB |
05_Rnd_huge_evil7.txt | AC | 484 ms
44,080 KB |
99_evil_01.txt | AC | 479 ms
44,084 KB |
ソースコード
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd, log2 from itertools import accumulate, permutations, combinations, product from operator import itemgetter, mul, add from copy import deepcopy from string import ascii_lowercase, ascii_uppercase, digits from bisect import bisect, bisect_left from heapq import heappush, heappop from functools import reduce, lru_cache import numpy as np def input(): return sys.stdin.buffer.readline()[:-1] def INT(): return int(input()) def MAP(): return map(int, input().split()) def LIST(): return list(map(int, input().split())) def ZIP(n): return zip(*(MAP() for _ in range(n))) sys.setrecursionlimit(10 ** 9) INF = float('inf') mod = 10 ** 9 + 7 N = INT() def matpow(A, n): # 2分累乗 B = np.identity(len(A), np.int64) while n > 0: if n & 1: B = B.dot(A) B %= mod A = A.dot(A) A %= mod n >>= 1 return B A = [ [0, 1, 1, 1], [1, 0, 1, 1], [1, 1, 0, 1], [1, 1, 1, 0] ] A = np.array(A, dtype=np.int64) print(matpow(A, N)[0][0])