結果

問題 No.2373 wa, wo, n
ユーザー Today03Today03
提出日時 2023-07-07 21:44:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 778 bytes
コンパイル時間 2,165 ms
コンパイル使用メモリ 206,452 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-28 22:47:20
合計ジャッジ時間 3,963 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 WA -
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,504 KB
testcase_13 WA -
testcase_14 AC 8 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 8 ms
4,376 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 3 ms
4,380 KB
testcase_20 AC 8 ms
4,376 KB
testcase_21 AC 5 ms
4,380 KB
testcase_22 AC 6 ms
4,380 KB
testcase_23 AC 6 ms
4,376 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 WA -
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 9 ms
4,380 KB
testcase_33 AC 10 ms
4,376 KB
testcase_34 AC 8 ms
4,380 KB
testcase_35 AC 6 ms
4,376 KB
testcase_36 AC 9 ms
4,380 KB
testcase_37 AC 8 ms
4,380 KB
testcase_38 AC 8 ms
4,380 KB
testcase_39 AC 11 ms
4,380 KB
testcase_40 AC 9 ms
4,380 KB
testcase_41 AC 10 ms
4,376 KB
testcase_42 AC 8 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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(0,2);
    if (count(ok.begin(),ok.end(),str)) {
      s.pop_back();
      s.pop_back();
    }
    else {
      break;
    }
  }
  cout<<(s.size()==0?"Yes":"No")<<endl;
}
0