結果
問題 | No.658 テトラナッチ数列 Hard |
ユーザー | vwxyz |
提出日時 | 2021-10-20 23:23:36 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 173 ms / 2,000 ms |
コード長 | 860 bytes |
コンパイル時間 | 240 ms |
コンパイル使用メモリ | 81,564 KB |
実行使用メモリ | 89,756 KB |
最終ジャッジ日時 | 2023-10-20 11:13:59 |
合計ジャッジ時間 | 2,821 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 159 ms
89,236 KB |
testcase_01 | AC | 158 ms
89,232 KB |
testcase_02 | AC | 158 ms
89,236 KB |
testcase_03 | AC | 158 ms
89,244 KB |
testcase_04 | AC | 169 ms
89,756 KB |
testcase_05 | AC | 171 ms
89,756 KB |
testcase_06 | AC | 171 ms
89,752 KB |
testcase_07 | AC | 172 ms
89,756 KB |
testcase_08 | AC | 171 ms
89,752 KB |
testcase_09 | AC | 173 ms
89,756 KB |
testcase_10 | AC | 172 ms
89,756 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)