結果

問題 No.3779 L or R
コンテスト
ユーザー daiota
提出日時 2026-10-30 22:15:56
言語 C++17
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 710 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,561 ms
コンパイル使用メモリ 217,968 KB
実行使用メモリ 9,924 KB
最終ジャッジ日時 2026-10-30 22:16:02
合計ジャッジ時間 5,256 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge7_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other WA * 40
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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;
	string S;
	cin >> N >> S;



	ll c=0;
	REP(i,N){
		if(S[i]=='x'){
			if(c%2==0){
				c++;
			}
			else{
				continue;
			}
		}
		else{
			if(c%2==1){
				c++;
			}
			else{
				continue;
			}
		}

	}



	ll x=N-c;
	if(x%2==0){
		cout << "Yes" << endl;
		REP(i,N) cout << 'R';
		cout << endl;
	}
	else{
		if(N==1){
			cout << "No" << endl;
		}
		else{
			cout << "Yes" << endl;
			cout << 'L';
			REP(i,N-1) cout << 'R';
			cout << endl;

		}



	}







	return 0;

}
0