結果
問題 |
No.3183 Swap or Rotate
|
ユーザー |
|
提出日時 | 2025-06-20 21:36:45 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 144 ms / 1,000 ms |
コード長 | 642 bytes |
コンパイル時間 | 238 ms |
コンパイル使用メモリ | 82,568 KB |
実行使用メモリ | 90,412 KB |
最終ジャッジ日時 | 2025-06-20 21:36:58 |
合計ジャッジ時間 | 4,903 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random #sys.setrecursionlimit(10**9) #sys.set_int_max_str_digits(0) #input = sys.stdin.readline n = int(input()) a = list(map(lambda x:int(x)+1,input().split())) ans = [] for i in range(2,n+1): while a[0] != i: ans.append('R') a.append(a.pop(0)) ans.append('S') a[0],a[1] = a[1],a[0] while a[0] != i-1: ans.append('R') a.append(a.pop(0)) ans.append('S') a[0],a[1] = a[1],a[0] while a != list(range(1,n+1)): ans.append('R') a.append(a.pop(0)) print(''.join(ans))