結果
| 問題 |
No.3183 Swap or Rotate
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-06-25 08:36:05 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 398 bytes |
| コンパイル時間 | 546 ms |
| コンパイル使用メモリ | 82,084 KB |
| 実行使用メモリ | 66,436 KB |
| 最終ジャッジ日時 | 2025-06-25 08:36:09 |
| 合計ジャッジ時間 | 4,161 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 WA * 11 |
ソースコード
from collections import deque
N = int(input())
P = deque(list(map(int,input().split())))
ans = []
for i in range(N-2,0,-1):
ind = P.index(i)
if P[(ind+1)%N]==i+1:continue
while True:
while P[0]!=i:
a = P.popleft()
P.append(a)
ans.append("R")
P[0],P[1] = P[1],P[0]
ans.append("S")
if P[2]==i+1:break
print("".join(ans))