結果

問題 No.1097 Remainder Operation
ユーザー 37zigen37zigen
提出日時 2020-06-27 06:02:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 396 bytes
コンパイル時間 741 ms
コンパイル使用メモリ 10,924 KB
実行使用メモリ 204,204 KB
最終ジャッジ日時 2023-09-18 18:55:48
合計ジャッジ時間 7,905 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,976 KB
testcase_01 AC 16 ms
7,916 KB
testcase_02 AC 20 ms
8,272 KB
testcase_03 AC 20 ms
8,376 KB
testcase_04 AC 20 ms
8,216 KB
testcase_05 AC 20 ms
8,224 KB
testcase_06 AC 20 ms
8,328 KB
testcase_07 AC 493 ms
34,896 KB
testcase_08 AC 490 ms
34,916 KB
testcase_09 AC 496 ms
34,944 KB
testcase_10 AC 480 ms
34,932 KB
testcase_11 AC 484 ms
35,048 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 #

N=int(input())
A=list(map(int,input().split()))
Q=int(input())
K=[int(input()) for i in range(Q)]
M=50
dp=[[-1]*M for i in range(N)]
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