結果

問題 No.1013 〇マス進む
ユーザー 👑 rin204rin204
提出日時 2022-10-30 16:55:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 238 ms / 2,000 ms
コード長 613 bytes
コンパイル時間 382 ms
コンパイル使用メモリ 86,980 KB
実行使用メモリ 143,244 KB
最終ジャッジ日時 2023-09-21 14:33:37
合計ジャッジ時間 18,174 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,428 KB
testcase_01 AC 71 ms
71,308 KB
testcase_02 AC 71 ms
71,560 KB
testcase_03 AC 79 ms
75,856 KB
testcase_04 AC 79 ms
75,824 KB
testcase_05 AC 82 ms
75,812 KB
testcase_06 AC 81 ms
75,820 KB
testcase_07 AC 81 ms
75,820 KB
testcase_08 AC 82 ms
75,804 KB
testcase_09 AC 82 ms
76,216 KB
testcase_10 AC 82 ms
75,728 KB
testcase_11 AC 78 ms
76,044 KB
testcase_12 AC 82 ms
76,072 KB
testcase_13 AC 93 ms
76,604 KB
testcase_14 AC 152 ms
107,728 KB
testcase_15 AC 190 ms
128,148 KB
testcase_16 AC 180 ms
123,484 KB
testcase_17 AC 141 ms
103,764 KB
testcase_18 AC 155 ms
110,396 KB
testcase_19 AC 128 ms
95,876 KB
testcase_20 AC 217 ms
140,604 KB
testcase_21 AC 139 ms
101,228 KB
testcase_22 AC 160 ms
111,236 KB
testcase_23 AC 108 ms
85,552 KB
testcase_24 AC 221 ms
142,232 KB
testcase_25 AC 213 ms
141,232 KB
testcase_26 AC 110 ms
85,660 KB
testcase_27 AC 135 ms
100,244 KB
testcase_28 AC 106 ms
85,848 KB
testcase_29 AC 209 ms
139,548 KB
testcase_30 AC 131 ms
97,192 KB
testcase_31 AC 169 ms
117,192 KB
testcase_32 AC 147 ms
106,688 KB
testcase_33 AC 153 ms
106,708 KB
testcase_34 AC 188 ms
125,480 KB
testcase_35 AC 188 ms
122,152 KB
testcase_36 AC 93 ms
76,592 KB
testcase_37 AC 93 ms
76,908 KB
testcase_38 AC 201 ms
130,324 KB
testcase_39 AC 126 ms
93,020 KB
testcase_40 AC 195 ms
125,456 KB
testcase_41 AC 111 ms
86,104 KB
testcase_42 AC 150 ms
105,004 KB
testcase_43 AC 126 ms
94,212 KB
testcase_44 AC 155 ms
107,100 KB
testcase_45 AC 143 ms
103,172 KB
testcase_46 AC 118 ms
88,080 KB
testcase_47 AC 150 ms
104,864 KB
testcase_48 AC 160 ms
110,692 KB
testcase_49 AC 194 ms
124,320 KB
testcase_50 AC 176 ms
117,064 KB
testcase_51 AC 166 ms
112,464 KB
testcase_52 AC 104 ms
83,208 KB
testcase_53 AC 111 ms
85,456 KB
testcase_54 AC 185 ms
121,972 KB
testcase_55 AC 119 ms
88,664 KB
testcase_56 AC 216 ms
134,784 KB
testcase_57 AC 175 ms
115,856 KB
testcase_58 AC 238 ms
143,100 KB
testcase_59 AC 236 ms
143,040 KB
testcase_60 AC 227 ms
143,244 KB
testcase_61 AC 220 ms
142,876 KB
testcase_62 AC 218 ms
142,696 KB
testcase_63 AC 73 ms
70,972 KB
testcase_64 AC 71 ms
71,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, K = map(int, input().split())
P = list(map(int, input().split()))

nex = [[0] * n for _ in range(30)]
tot = [[0] * n for _ in range(30)]
for i, p in enumerate(P):
    nex[0][i] = (i + p) % n
    tot[0][i] = p

for i in range(1, 30):
    for j in range(n):
        nex[i][j] = nex[i - 1][nex[i - 1][j]]
        tot[i][j] = tot[i -  1][j] + tot[i - 1][nex[i - 1][j]]

ans = [i for i in range(1, n + 1)]
pos = [i for i in range(n)]
for i in range(29, -1, -1):
    if not K >> i & 1:
        continue    
    for j in range(n):
        ans[j] += tot[i][pos[j]]
        pos[j] = nex[i][pos[j]]
print(*ans, sep="\n")
0