結果

問題 No.1097 Remainder Operation
ユーザー roarisroaris
提出日時 2020-06-27 05:56:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 519 bytes
コンパイル時間 1,193 ms
コンパイル使用メモリ 87,060 KB
実行使用メモリ 114,812 KB
最終ジャッジ日時 2023-09-18 18:54:35
合計ジャッジ時間 6,947 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,216 KB
testcase_01 AC 75 ms
71,488 KB
testcase_02 AC 87 ms
76,100 KB
testcase_03 AC 85 ms
76,040 KB
testcase_04 AC 81 ms
76,080 KB
testcase_05 AC 82 ms
76,184 KB
testcase_06 AC 84 ms
76,232 KB
testcase_07 AC 110 ms
80,052 KB
testcase_08 AC 108 ms
80,024 KB
testcase_09 AC 107 ms
79,960 KB
testcase_10 AC 107 ms
79,940 KB
testcase_11 AC 108 ms
80,096 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))
log_size = 30
dp = [[-1]*N for _ in range(log_size)]

for i in range(N):
    dp[0][i] = A[i]

for i in range(1, log_size):
    for j in range(N):
        dp[i][j] = dp[i-1][j]+dp[i-1][(j+dp[i-1][j])%N]

Q = int(input())

for _ in range(Q):
    K = int(input())
    ans = 0
    now = 0
    
    for i in range(log_size):
        if (K>>i)&1:
            ans += dp[i][now]
            now = (now+dp[i][now])%N
    
    print(ans)
0