結果
| 問題 | No.3779 L or R |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-07-20 02:23:55 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 8 ms / 2,000 ms |
| + 914µs | |
| コード長 | 926 bytes |
| 記録 | |
| コンパイル時間 | 1,229 ms |
| コンパイル使用メモリ | 172,220 KB |
| 実行使用メモリ | 9,908 KB |
| 最終ジャッジ日時 | 2026-10-30 20:50:51 |
| 合計ジャッジ時間 | 4,765 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 40 |
ソースコード
#include <iostream>
#include <vector>
#include <cassert>
using namespace std;
using ll=long long;
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n;
string s;
cin>>n>>s;
assert(1<=n&&n<=200000);
for(char c:s)assert(c=='o'||c=='x');
vector<int> a(n);
for(int i=0;i<n;i++)if(s[i]=='o')a[i]=1;
{
vector<int> b=a;
b[0]^=1;
int c=0;
string ans="L";
for(int i=1;i<n;i++){
if(b[i-1]==(b[i]^c)){
ans+='L';
b[i]=(1-b[i])^c;
}else{
ans+='R';
b[i]=(1-b[i])^c;
c=1-c;
}
}
if(b[n-1]==1){
cout<<"Yes"<<endl;
cout<<ans<<endl;
return 0;
}
}
{
vector<int> b=a;
b[0]^=1;
int c=1;
string ans="R";
for(int i=1;i<n;i++){
if(b[i-1]==(b[i]^c)){
ans+='L';
b[i]=(1-b[i])^c;
}else{
ans+='R';
b[i]=(1-b[i])^c;
c=1-c;
}
}
if(b[n-1]==1){
cout<<"Yes"<<endl;
cout<<ans<<endl;
return 0;
}
}
cout<<"No"<<endl;
}