結果
問題 | No.658 テトラナッチ数列 Hard |
ユーザー | vwxyz |
提出日時 | 2021-10-20 23:18:15 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 57 ms / 2,000 ms |
コード長 | 860 bytes |
コンパイル時間 | 79 ms |
コンパイル使用メモリ | 11,972 KB |
実行使用メモリ | 11,560 KB |
最終ジャッジ日時 | 2023-10-20 11:13:07 |
合計ジャッジ時間 | 1,493 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 44 ms
11,252 KB |
testcase_01 | AC | 40 ms
11,252 KB |
testcase_02 | AC | 40 ms
11,252 KB |
testcase_03 | AC | 40 ms
11,260 KB |
testcase_04 | AC | 52 ms
11,552 KB |
testcase_05 | AC | 54 ms
11,552 KB |
testcase_06 | AC | 52 ms
11,560 KB |
testcase_07 | AC | 53 ms
11,548 KB |
testcase_08 | AC | 57 ms
11,544 KB |
testcase_09 | AC | 53 ms
11,548 KB |
testcase_10 | AC | 54 ms
11,548 KB |
ソースコード
import bisect import copy import decimal import fractions import functools import heapq import itertools import math import random import sys from collections import Counter,deque,defaultdict from functools import lru_cache,reduce from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max def _heappush_max(heap,item): heap.append(item) heapq._siftdown_max(heap, 0, len(heap)-1) def _heappushpop_max(heap, item): if heap and item < heap[0]: item, heap[0] = heap[0], item heapq._siftup_max(heap, 0) return item from math import gcd as GCD read=sys.stdin.read readline=sys.stdin.readline readlines=sys.stdin.readlines fib=[0,0,0,1] for i in range(4,4912): fib.append((fib[-1]+fib[-2]+fib[-3]+fib[-4])%17) Q=int(readline()) for i in range(Q): N=int(readline()) ans=fib[(N-1)%4912] print(ans)