結果

問題 No.1097 Remainder Operation
ユーザー 37zigen37zigen
提出日時 2020-06-27 06:12:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 500 bytes
コンパイル時間 74 ms
コンパイル使用メモリ 10,924 KB
実行使用メモリ 39,232 KB
最終ジャッジ日時 2023-09-18 18:57:00
合計ジャッジ時間 11,944 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
29,608 KB
testcase_01 AC 130 ms
29,400 KB
testcase_02 AC 141 ms
29,580 KB
testcase_03 AC 140 ms
29,668 KB
testcase_04 AC 142 ms
29,488 KB
testcase_05 AC 138 ms
29,532 KB
testcase_06 AC 140 ms
29,624 KB
testcase_07 AC 1,126 ms
38,936 KB
testcase_08 AC 1,075 ms
39,232 KB
testcase_09 AC 1,123 ms
39,156 KB
testcase_10 AC 1,126 ms
39,196 KB
testcase_11 AC 1,076 ms
39,128 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
from sys import stdin
readline = stdin.readline

N=int(readline())
A=list(map(int,readline().split()))
Q=int(readline())
K=[int(readline()) for i in range(Q)]
M=50
dp=np.array([[-1]*M for i in range(N)],dtype="int64")
for i in range(N):
    dp[i][0]=A[i%N]
for j in range(M-1):
    for i in range(N):
        middle=(dp[i][j]+i)%N
        dp[i][j+1]=dp[i][j]+dp[middle][j]

for k in K:
    X=0
    for i in range(M):
        if (k>>i)%2==1:
            X=X+dp[X%N][i]
    print(X)
0