結果
| 問題 |
No.1379 Postponed
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 12:58:09 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,042 bytes |
| コンパイル時間 | 209 ms |
| コンパイル使用メモリ | 82,352 KB |
| 実行使用メモリ | 84,908 KB |
| 最終ジャッジ日時 | 2025-06-12 13:04:48 |
| 合計ジャッジ時間 | 6,339 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 26 WA * 12 TLE * 1 -- * 25 |
ソースコード
n, k = map(int, input().split())
current = list(map(int, input().split()))
steps_remaining = k
while steps_remaining > 0:
m = current[0]
rotate_length = m + 1
if rotate_length > n:
rotate_length = n
# Generate next array after one step
rotated_part = current[1:rotate_length] + [current[0]]
remaining_part = current[rotate_length:]
next_array = rotated_part + remaining_part
next_m = next_array[0]
if next_m == m:
# Calculate effective steps
effective_steps = (steps_remaining - 1) % (m + 1)
# Apply effective_steps rotations to the first m+1 elements of next_array
rotated_part_initial = next_array[:m+1]
shift = effective_steps % (m + 1)
rotated_part_after = rotated_part_initial[shift:] + rotated_part_initial[:shift]
# Update current array
current = rotated_part_after + next_array[m+1:]
steps_remaining = 0
else:
current = next_array
steps_remaining -= 1
print(' '.join(map(str, current)))
gew1fw