結果

問題 No.1013 〇マス進む
ユーザー neterukunneterukun
提出日時 2020-03-31 03:37:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 263 ms / 2,000 ms
コード長 745 bytes
コンパイル時間 814 ms
コンパイル使用メモリ 86,960 KB
実行使用メモリ 114,620 KB
最終ジャッジ日時 2023-09-05 19:18:07
合計ジャッジ時間 12,657 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,216 KB
testcase_01 AC 71 ms
71,020 KB
testcase_02 AC 73 ms
71,372 KB
testcase_03 AC 83 ms
76,600 KB
testcase_04 AC 79 ms
76,540 KB
testcase_05 AC 80 ms
76,608 KB
testcase_06 AC 82 ms
76,760 KB
testcase_07 AC 81 ms
76,692 KB
testcase_08 AC 79 ms
76,580 KB
testcase_09 AC 82 ms
76,940 KB
testcase_10 AC 82 ms
76,608 KB
testcase_11 AC 83 ms
76,620 KB
testcase_12 AC 81 ms
76,504 KB
testcase_13 AC 84 ms
76,820 KB
testcase_14 AC 117 ms
86,820 KB
testcase_15 AC 144 ms
92,724 KB
testcase_16 AC 137 ms
91,492 KB
testcase_17 AC 111 ms
85,160 KB
testcase_18 AC 123 ms
87,436 KB
testcase_19 AC 103 ms
81,632 KB
testcase_20 AC 145 ms
95,972 KB
testcase_21 AC 109 ms
84,292 KB
testcase_22 AC 123 ms
87,392 KB
testcase_23 AC 92 ms
78,248 KB
testcase_24 AC 162 ms
98,468 KB
testcase_25 AC 150 ms
97,640 KB
testcase_26 AC 92 ms
78,372 KB
testcase_27 AC 105 ms
83,800 KB
testcase_28 AC 93 ms
78,184 KB
testcase_29 AC 145 ms
96,748 KB
testcase_30 AC 105 ms
83,024 KB
testcase_31 AC 126 ms
89,828 KB
testcase_32 AC 115 ms
86,580 KB
testcase_33 AC 146 ms
93,504 KB
testcase_34 AC 195 ms
102,736 KB
testcase_35 AC 198 ms
101,524 KB
testcase_36 AC 90 ms
76,784 KB
testcase_37 AC 95 ms
76,704 KB
testcase_38 AC 208 ms
105,436 KB
testcase_39 AC 125 ms
85,092 KB
testcase_40 AC 212 ms
103,800 KB
testcase_41 AC 111 ms
81,400 KB
testcase_42 AC 150 ms
91,536 KB
testcase_43 AC 126 ms
85,200 KB
testcase_44 AC 156 ms
93,636 KB
testcase_45 AC 145 ms
91,384 KB
testcase_46 AC 117 ms
82,008 KB
testcase_47 AC 138 ms
90,556 KB
testcase_48 AC 159 ms
94,320 KB
testcase_49 AC 203 ms
101,428 KB
testcase_50 AC 177 ms
99,312 KB
testcase_51 AC 164 ms
95,104 KB
testcase_52 AC 99 ms
76,992 KB
testcase_53 AC 109 ms
81,532 KB
testcase_54 AC 188 ms
101,920 KB
testcase_55 AC 116 ms
82,448 KB
testcase_56 AC 230 ms
109,580 KB
testcase_57 AC 189 ms
98,656 KB
testcase_58 AC 263 ms
113,628 KB
testcase_59 AC 250 ms
114,488 KB
testcase_60 AC 235 ms
114,620 KB
testcase_61 AC 145 ms
96,284 KB
testcase_62 AC 130 ms
94,176 KB
testcase_63 AC 69 ms
71,304 KB
testcase_64 AC 72 ms
71,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def doubling(max_size, n):
    log_size = max_size.bit_length()
    double = [[-1] * n for i in range(log_size)]

    # ダブリングで2^0回(= 1回)たどって到達する値を求める
    for i in range(n):
        double[0][i] = p[i]
    
    # ダブリングで2^k回たどって到達する値を求める
    for k in range(1, log_size):
        for i in range(n):
            double[k][i] = double[k - 1][(double[k - 1][i] + i) % n] + double[k - 1][i]
    return double

  
n, k = map(int, input().split())
p = list(map(int, input().split()))

double = doubling(k + 10, n)
for i in range(n):
    ans = i
    for kk in range((k + 10).bit_length()):
        if (k >> kk) & 1:
            ans += double[kk][ans % n]
    print(ans + 1)
0