結果

問題 No.3183 Swap or Rotate
ユーザー sasa8uyauya
提出日時 2025-06-20 21:28:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 80 ms / 1,000 ms
コード長 303 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 82,836 KB
実行使用メモリ 76,048 KB
最終ジャッジ日時 2025-06-20 21:28:32
合計ジャッジ時間 2,968 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(map(int,input().split()))
op=""
i=a.index(n-1)
for p in reversed(range(n)):
  i=a.index(p)
  if i==p:
    continue
  for _ in range(p):
    if a[0]==p:
      op+="S"
      a[0],a[1]=a[1],a[0]
    op+="R"
    a=a[1:]+a[:1]
  while a[-1]!=n-1:
    op+="R"
    a=a[1:]+a[:1]
print(op)
0