結果

問題 No.3183 Swap or Rotate
ユーザー 👑 loop0919
提出日時 2025-06-20 23:32:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 86 ms / 1,000 ms
コード長 314 bytes
コンパイル時間 380 ms
コンパイル使用メモリ 82,424 KB
実行使用メモリ 78,052 KB
最終ジャッジ日時 2025-06-20 23:32:13
合計ジャッジ時間 3,290 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

N = int(input())
A = deque(map(int, input().split()))

ans = []

while A != deque([*range(N)]):
    if 0 not in (A[0], A[1]) and A[0] > A[1]:
        A[0], A[1] = A[1], A[0]
        ans.append("S")
    else:
        A.append(A.popleft())
        ans.append("R")

print(*ans, sep="")
0