結果
| 問題 |
No.2373 wa, wo, n
|
| コンテスト | |
| ユーザー |
Today03
|
| 提出日時 | 2023-07-07 21:46:00 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 787 bytes |
| コンパイル時間 | 1,935 ms |
| コンパイル使用メモリ | 199,252 KB |
| 最終ジャッジ日時 | 2025-02-15 07:05:27 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 WA * 13 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
string s;
cin>>n>>s;
string t;
for (int i=0;i<n;i++) {
t.push_back(s[i]);
if (s[i]=='n') {
t.push_back(s[i]);
}
}
s=t;
reverse(s.begin(),s.end());
vector<string> ok_={"aw","ow","nn"},ok;
for (int i=0;i<3;i++) {
for (int j=0;j<1<<2;j++) {
string str;
for (int k=0;k<2;k++) {
if (j>>k&1) {
str.push_back(ok_[i][k]);
}
else {
str.push_back('?');
}
}
ok.push_back(str);
}
}
while (s.size()>=2) {
string str=s.substr(s.size()-2,2);
if (count(ok.begin(),ok.end(),str)) {
s.pop_back();
s.pop_back();
}
else {
break;
}
}
cout<<(s.size()==0?"Yes":"No")<<endl;
}
Today03