結果
| 問題 | No.1379 Postponed |
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 18:10:34 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 955 bytes |
| コンパイル時間 | 212 ms |
| コンパイル使用メモリ | 82,388 KB |
| 実行使用メモリ | 856,772 KB |
| 最終ジャッジ日時 | 2025-06-12 18:12:33 |
| 合計ジャッジ時間 | 10,130 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 40 MLE * 1 -- * 23 |
ソースコード
n, k = map(int, input().split())
a = list(map(int, input().split()))
if k == 0:
print(' '.join(map(str, a)))
exit()
history = {}
current = a.copy()
steps = 0
found_cycle = False
while steps < k:
key = tuple(current)
if key in history:
prev_step = history[key]
cycle_length = steps - prev_step
remaining = k - steps
remaining %= cycle_length
k = remaining
found_cycle = True
break
else:
history[key] = steps
a0 = current[0]
m = a0 + 1
if m > len(current):
m = len(current)
new_current = current[1:m] + [current[0]] + current[m:]
current = new_current
steps += 1
if found_cycle:
for _ in range(k):
a0 = current[0]
m = a0 + 1
if m > len(current):
m = len(current)
new_current = current[1:m] + [current[0]] + current[m:]
current = new_current
print(' '.join(map(str, current)))
gew1fw