結果
問題 |
No.3183 Swap or Rotate
|
ユーザー |
|
提出日時 | 2025-06-27 01:48:58 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 44 ms / 1,000 ms |
コード長 | 663 bytes |
コンパイル時間 | 510 ms |
コンパイル使用メモリ | 12,032 KB |
実行使用メモリ | 10,496 KB |
最終ジャッジ日時 | 2025-06-27 01:49:02 |
合計ジャッジ時間 | 3,086 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
import sys def solve(): try: line = sys.stdin.readline() if not line: return N = int(line) P = list(map(int, sys.stdin.readline().split())) operations = [] for _ in range(N): for _ in range(N - 1): if P[0] > P[1]: P[0], P[1] = P[1], P[0] operations.append("S") P.append(P.pop(0)) operations.append("R") P.append(P.pop(0)) operations.append("R") print("".join(operations)) except (IOError, ValueError): pass if __name__ == "__main__": solve()