結果

問題 No.1013 〇マス進む
ユーザー rlangevinrlangevin
提出日時 2023-10-18 00:43:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 240 ms / 2,000 ms
コード長 469 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 81,772 KB
実行使用メモリ 116,664 KB
最終ジャッジ日時 2023-10-18 00:44:10
合計ジャッジ時間 16,539 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,364 KB
testcase_01 AC 36 ms
53,364 KB
testcase_02 AC 37 ms
53,364 KB
testcase_03 AC 48 ms
62,304 KB
testcase_04 AC 43 ms
59,492 KB
testcase_05 AC 50 ms
62,304 KB
testcase_06 AC 49 ms
62,304 KB
testcase_07 AC 51 ms
64,352 KB
testcase_08 AC 48 ms
62,296 KB
testcase_09 AC 48 ms
62,296 KB
testcase_10 AC 50 ms
64,352 KB
testcase_11 AC 50 ms
62,304 KB
testcase_12 AC 50 ms
64,352 KB
testcase_13 AC 56 ms
66,568 KB
testcase_14 AC 117 ms
94,284 KB
testcase_15 AC 156 ms
107,088 KB
testcase_16 AC 148 ms
103,952 KB
testcase_17 AC 104 ms
91,708 KB
testcase_18 AC 120 ms
95,932 KB
testcase_19 AC 92 ms
86,568 KB
testcase_20 AC 175 ms
115,260 KB
testcase_21 AC 103 ms
90,056 KB
testcase_22 AC 123 ms
96,492 KB
testcase_23 AC 73 ms
77,612 KB
testcase_24 AC 180 ms
116,112 KB
testcase_25 AC 176 ms
115,536 KB
testcase_26 AC 73 ms
77,640 KB
testcase_27 AC 97 ms
89,440 KB
testcase_28 AC 73 ms
77,708 KB
testcase_29 AC 173 ms
114,432 KB
testcase_30 AC 96 ms
87,664 KB
testcase_31 AC 131 ms
100,048 KB
testcase_32 AC 106 ms
93,684 KB
testcase_33 AC 123 ms
93,676 KB
testcase_34 AC 160 ms
105,692 KB
testcase_35 AC 164 ms
103,124 KB
testcase_36 AC 59 ms
68,624 KB
testcase_37 AC 59 ms
68,616 KB
testcase_38 AC 172 ms
107,936 KB
testcase_39 AC 92 ms
83,276 KB
testcase_40 AC 181 ms
105,420 KB
testcase_41 AC 80 ms
78,092 KB
testcase_42 AC 123 ms
92,352 KB
testcase_43 AC 97 ms
85,420 KB
testcase_44 AC 120 ms
93,864 KB
testcase_45 AC 111 ms
91,396 KB
testcase_46 AC 80 ms
78,584 KB
testcase_47 AC 113 ms
92,332 KB
testcase_48 AC 127 ms
95,944 KB
testcase_49 AC 180 ms
104,248 KB
testcase_50 AC 152 ms
100,048 KB
testcase_51 AC 137 ms
97,056 KB
testcase_52 AC 68 ms
72,720 KB
testcase_53 AC 82 ms
80,332 KB
testcase_54 AC 143 ms
103,120 KB
testcase_55 AC 84 ms
79,112 KB
testcase_56 AC 186 ms
111,144 KB
testcase_57 AC 160 ms
99,212 KB
testcase_58 AC 240 ms
116,664 KB
testcase_59 AC 225 ms
116,664 KB
testcase_60 AC 197 ms
116,664 KB
testcase_61 AC 170 ms
116,664 KB
testcase_62 AC 159 ms
116,664 KB
testcase_63 AC 37 ms
53,364 KB
testcase_64 AC 37 ms
53,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
P = list(map(int, input().split()))
M = 35
dp = [[0] * N for _ in range(M)] 
for i in range(N):
    dp[0][i] = i + P[i]
    
for n in range(1, M):
    for i in range(N):
        dp[n][i] = dp[n - 1][dp[n - 1][i] % N] + dp[n - 1][i] // N * N
        
for i in range(N):
    now = i
    ans = i + 1
    for j in range(M):
        if (K >> j) & 1:
            ans += dp[j][now % N] - now % N
            now = dp[j][now % N]
    print(ans)
0