結果
問題 |
No.3183 Swap or Rotate
|
ユーザー |
|
提出日時 | 2025-06-20 21:24:21 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 437 bytes |
コンパイル時間 | 798 ms |
コンパイル使用メモリ | 68,252 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-06-20 21:24:23 |
合計ジャッジ時間 | 1,620 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include<iostream> #include<algorithm> #include<cassert> using namespace std; int N; int P[100]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin>>N; for(int i=0;i<N;i++)cin>>P[i]; string S=""; for(int t=0;t<N-1;t++) { for(int i=0;i<N-1;i++) { if(P[0]>P[1])swap(P[0],P[1]),S+='S'; rotate(P,P+1,P+N); S+='R'; } S+='R'; rotate(P,P+1,P+N); } for(int i=0;i<N;i++)assert(P[i]==i); cout<<S<<endl; }