結果
| 問題 | 
                            No.1379 Postponed
                             | 
                    
| コンテスト | |
| ユーザー | 
                             gew1fw
                         | 
                    
| 提出日時 | 2025-06-12 20:57:42 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                MLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,172 bytes | 
| コンパイル時間 | 209 ms | 
| コンパイル使用メモリ | 82,176 KB | 
| 実行使用メモリ | 851,372 KB | 
| 最終ジャッジ日時 | 2025-06-12 21:01:23 | 
| 合計ジャッジ時間 | 10,212 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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
    A0 = list(map(int, input[idx:idx+N]))
    idx += N
    if K == 0:
        print(' '.join(map(str, A0)))
        return
    def next_array(current):
        x = current[0]
        m = x + 1
        if m > len(current):
            m = len(current)
        rotated = current[1:m] + [current[0]]
        new_arr = rotated + current[m:]
        return new_arr
    seen = {}
    steps = [A0.copy()]
    seen[tuple(A0)] = 0
    for step in range(1, K + 1):
        current = next_array(steps[step - 1])
        tupled = tuple(current)
        if tupled in seen:
            start_step = seen[tupled]
            cycle_length = step - start_step
            remaining = K - start_step
            effective_step = (remaining % cycle_length) + start_step
            result = steps[effective_step]
            print(' '.join(map(str, result)))
            return
        else:
            seen[tupled] = step
            steps.append(current)
    print(' '.join(map(str, steps[K])))
if __name__ == '__main__':
    main()
            
            
            
        
            
gew1fw