結果
問題 |
No.1379 Postponed
|
ユーザー |
![]() |
提出日時 | 2025-03-20 20:21:35 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 792 bytes |
コンパイル時間 | 173 ms |
コンパイル使用メモリ | 82,488 KB |
実行使用メモリ | 855,596 KB |
最終ジャッジ日時 | 2025-03-20 20:23:14 |
合計ジャッジ時間 | 10,979 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 40 MLE * 1 -- * 23 |
ソースコード
n, k = map(int, input().split()) a = list(map(int, input().split())) current = a.copy() seen = {} history = [current.copy()] for step in range(k): current_tuple = tuple(current) if current_tuple in seen: start_step = seen[current_tuple] cycle_length = step - start_step remaining_steps = k - step if remaining_steps > 0: pos_in_cycle = remaining_steps % cycle_length current = history[start_step + pos_in_cycle] else: current = history[step] break seen[current_tuple] = step x = current[0] m = x + 1 if m > n: m = n current = current[1:m] + [current[0]] + current[m:] history.append(current.copy()) else: current = history[-1] print(' '.join(map(str, current)))