結果

問題 No.3183 Swap or Rotate
ユーザー Mitarushi
提出日時 2025-06-15 10:08:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 402 bytes
コンパイル時間 208 ms
コンパイル使用メモリ 82,392 KB
実行使用メモリ 62,460 KB
最終ジャッジ日時 2025-06-15 12:30:55
合計ジャッジ時間 4,336 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
assert 2 <= n <= 100
p = list(map(int, input().split()))
assert len(p) == n
assert set(p) == set(range(n))

not_yet = True
ans = []
while not_yet:
    not_yet = False
    for i in range(n - 1):
        if p[i] > p[i + 1]:
            not_yet = True
            p[i], p[i + 1] = p[i + 1], p[i]
            ans.append('S')
        ans.append('R')
    ans.append('P')

print(''.join(ans))
0