結果
問題 |
No.1379 Postponed
|
ユーザー |
![]() |
提出日時 | 2025-06-12 15:58:15 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 1,536 bytes |
コンパイル時間 | 135 ms |
コンパイル使用メモリ | 82,372 KB |
実行使用メモリ | 859,196 KB |
最終ジャッジ日時 | 2025-06-12 15:58:52 |
合計ジャッジ時間 | 9,242 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 40 MLE * 1 -- * 23 |
ソースコード
def main(): import sys input = sys.stdin.read().split() idx = 0 N = int(input[idx]) idx += 1 K = int(input[idx]) idx += 1 A = list(map(int, input[idx:idx+N])) idx += N if K == 0: print(' '.join(map(str, A))) return seen = {} initial_tuple = tuple(A) seen[initial_tuple] = 0 current_array = A.copy() current_step = 0 while current_step < K: a = current_array[0] next_array = current_array.copy() for i in range(a + 1): if i < a: next_array[i] = current_array[i + 1] else: next_array[i] = a next_tuple = tuple(next_array) current_step += 1 if next_tuple in seen: first_seen = seen[next_tuple] cycle_length = current_step - first_seen remaining_steps = (K - first_seen) % cycle_length temp = list(next_tuple) for _ in range(remaining_steps): a_temp = temp[0] new_temp = temp.copy() for i in range(a_temp + 1): if i < a_temp: new_temp[i] = temp[i + 1] else: new_temp[i] = a_temp temp = new_temp print(' '.join(map(str, temp))) return else: seen[next_tuple] = current_step current_array = next_array print(' '.join(map(str, current_array))) if __name__ == "__main__": main()