結果

問題 No.3183 Swap or Rotate
ユーザー daiota
提出日時 2025-06-20 23:42:04
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 557 bytes
コンパイル時間 1,455 ms
コンパイル使用メモリ 168,680 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-06-20 23:42:08
合計ジャッジ時間 2,863 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(ll i=0;i<ll(n);i++)










int main(void){
	cin.tie(nullptr);  ios_base::sync_with_stdio(false);
	ll i,j,k;




	ll N;
	cin >> N;
	vector<ll> s(N),t(N);
	REP(i,N){
		cin >> s[i];
		t[i]=i;
	}


	string ans;
	while(1){
		if(s[0]>s[1] && s[0]!=N-1){
			swap(s[0],s[1]);
			ans+='S';
			if(s==t) break;
		}else{
			s.push_back(s[0]);
			s.erase(s.begin());
			ans+='R';
			if(s==t) break;
		}

	}



	cout << ans << endl;







	return 0;

}
0