結果

問題 No.1097 Remainder Operation
ユーザー 37zigen37zigen
提出日時 2020-06-27 06:10:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 440 bytes
コンパイル時間 655 ms
コンパイル使用メモリ 10,956 KB
実行使用メモリ 129,496 KB
最終ジャッジ日時 2023-09-18 18:56:41
合計ジャッジ時間 13,641 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
33,848 KB
testcase_01 AC 132 ms
29,576 KB
testcase_02 AC 137 ms
29,528 KB
testcase_03 AC 137 ms
29,480 KB
testcase_04 AC 135 ms
29,476 KB
testcase_05 AC 136 ms
29,552 KB
testcase_06 AC 135 ms
29,556 KB
testcase_07 AC 1,107 ms
39,232 KB
testcase_08 AC 1,063 ms
39,208 KB
testcase_09 AC 1,137 ms
39,076 KB
testcase_10 AC 1,121 ms
39,084 KB
testcase_11 AC 1,111 ms
39,148 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

N=int(input())
A=list(map(int,input().split()))
Q=int(input())
K=[int(input()) 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