結果

問題 No.1097 Remainder Operation
ユーザー MasKoaTSMasKoaTS
提出日時 2022-03-12 15:50:10
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,004 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 81,844 KB
実行使用メモリ 88,744 KB
最終ジャッジ日時 2023-10-16 23:22:25
合計ジャッジ時間 7,916 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
85,788 KB
testcase_01 AC 128 ms
85,784 KB
testcase_02 AC 144 ms
88,736 KB
testcase_03 AC 144 ms
88,736 KB
testcase_04 AC 144 ms
88,744 KB
testcase_05 AC 145 ms
88,732 KB
testcase_06 AC 144 ms
88,732 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools as iter
import collections as coll
import heapq as hq
import bisect as bis
from decimal import Decimal as dec
from functools import cmp_to_key
import math
import sys
#import pypyjit
#pypyjit.set_param('max_unroll_recursion=-1')
sys.setrecursionlimit(10 ** 6)
inp = sys.stdin.readline
input = lambda : inp().rstrip()
getN = lambda : int(inp())
getNs = lambda : map(int, inp().split())
getList = lambda :list(map(int, inp().split()))
getStrs = lambda n : [input() for _ in [0] * n]
def yexit(): print("Yes"); exit(0)
def nexit(): print("No"); exit(0)
pi = 3.141592653589793
mod = 10 ** 9 + 7
MOD = 998244353
INF = 10 ** 18
dx = [1, 0, -1, 0];	dy = [0, 1, 0, -1]


"""
Main Code
"""

n = getN()
a = getList()
q = getN()
query = [getN() for _ in [0] * q]

def calc(db, now):
	next = [0] * n
	for i in range(n):
		next[i] = now[i] + db[(i + now[i]) % n]
	return next

for t in query:
	db = a[:]
	ans = 0
	while(t):
		if(t & 1):
			ans += db[ans % n]
		db = calc(db, db)
		t >>= 1
	print(ans)
0