結果
問題 |
No.1379 Postponed
|
ユーザー |
![]() |
提出日時 | 2025-04-15 22:59:20 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,209 bytes |
コンパイル時間 | 410 ms |
コンパイル使用メモリ | 82,200 KB |
実行使用メモリ | 83,380 KB |
最終ジャッジ日時 | 2025-04-15 23:01:08 |
合計ジャッジ時間 | 6,290 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 40 TLE * 1 -- * 23 |
ソースコード
n, k = map(int, input().split()) original = list(map(int, input().split())) current = original.copy() steps = 0 found_cycle = False cycle_length = 0 # First pass to detect cycle while steps < k: if current == original: if steps != 0: # Found a cycle cycle_length = steps remaining = k % cycle_length k = remaining found_cycle = True break a_prev = current[0] m = a_prev + 1 if m > n: m = n rotated_part = current[1:m] + [current[0]] new_current = rotated_part + current[m:] current = new_current steps += 1 # Check after incrementing steps if current == original and steps != 0: cycle_length = steps remaining = k % cycle_length k = remaining found_cycle = True break # If cycle found, reset and simulate remaining steps if found_cycle: current = original.copy() steps = 0 while steps < k: a_prev = current[0] m = a_prev + 1 if m > n: m = n rotated_part = current[1:m] + [current[0]] current = rotated_part + current[m:] steps += 1 print(' '.join(map(str, current)))