結果
| 問題 | No.3779 L or R |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-07-04 01:21:02 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 7 ms / 2,000 ms |
| + 335µs | |
| コード長 | 843 bytes |
| 記録 | |
| コンパイル時間 | 1,267 ms |
| コンパイル使用メモリ | 172,472 KB |
| 実行使用メモリ | 9,928 KB |
| 最終ジャッジ日時 | 2026-10-30 20:50:08 |
| 合計ジャッジ時間 | 5,705 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 40 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
using ll=long long;
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n;
string s;
cin>>n>>s;
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;
}