結果

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

ソースコード

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('S')

print(''.join(ans))
0