結果
問題 |
No.3183 Swap or Rotate
|
ユーザー |
|
提出日時 | 2025-06-20 22:20:11 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 561 bytes |
コンパイル時間 | 2,042 ms |
コンパイル使用メモリ | 204,620 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-06-20 22:20:15 |
合計ジャッジ時間 | 3,091 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; vector<int> P(N),Q(N); for(auto &p : P) cin >> p; Q = P; sort(Q.begin(),Q.end()); string answer = ""; while(answer.size() < 19900){ if(P.at(0) > P.at(1) && P.at(0) != N-1) answer += 'S',swap(P.at(0),P.at(1)); else answer += 'R',rotate(P.begin(),P.begin()+1,P.end()); } while(P.at(0) != 0) answer += 'R',rotate(P.begin(),P.begin()+1,P.end()); cout << answer << endl; }