結果
| 問題 |
No.2240 WAC
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-03-10 22:37:56 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,389 bytes |
| コンパイル時間 | 1,920 ms |
| コンパイル使用メモリ | 193,232 KB |
| 最終ジャッジ日時 | 2025-02-11 08:48:01 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 RE * 32 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
/*main*/
int main() {
int n,m; cin >> n >> m;
string s; cin >> s;
int flag = 0;
for(int i=0;i<(n+m)/2;i++){
if(s.at(i)=='W') {
int j=i+1;
while(j<(n+m)*2){
if(s.at(j)=='A'){
s.at(j) = 'B';
break;
}
j++;
}
if(j==(n+m)*2){
cout << "No" << endl;
return 0;
}
}
else if(s.at(i)=='A') {
int j=i+1;
while(j<(n+m)*2){
if(s.at(j)=='C'){
s.at(j) = 'B';
break;
}
j++;
}
if(j==(n+m)*2){
cout << "No" << endl;
return 0;
}
}
else if(s.at(i)='B'){
cout << "No" << endl;
return 0;
}
if(s.at((n+m)*2-i-1)=='A') {
int j=(n+m)*2-1;
while(j>0){
if(s.at(j)=='W'){
s.at(j) = 'B';
break;
}
j++;
}
if(j==0){
cout << "No" << endl;
return 0;
}
}
else if(s.at((n+m)*2-i-1)=='C') {
int j=(n+m)*2-1;
while(j>0){
if(s.at(j)=='A'){
s.at(j) = 'B';
break;
}
j++;
}
if(j==0){
cout << "No" << endl;
return 0;
}
}
else if(s.at((n+m)*2-i-1) != 'B'){
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
}