結果

問題 No.2373 wa, wo, n
ユーザー as277575as277575
提出日時 2023-07-07 22:18:10
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 1,497 bytes
コンパイル時間 1,508 ms
コンパイル使用メモリ 130,828 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-28 23:40:21
合計ジャッジ時間 3,695 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <algorithm>
#include <bit>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <random>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <set>
#include <string>

using namespace::std;

template<typename T, typename U>
ostream& operator<< (ostream& o, const pair<T, U>& p) {
  o << "<" << p.first << ", " << p.second << ">";
  return o;
}

template <typename T>
ostream& operator<< (ostream& o, const vector<T>& v) {
 for (const auto& x : v) o << x << " ";
 return o;
}

ostream& operator<<(ostream& o, const unordered_map<long long, long long>& m) {
  o << "{";
  for (const auto& [k, v] : m)
    o << " " << k << ": " << v << ",";
  o << "}";
  return o;
}

template <typename T>
istream& operator>> (istream& i, vector<T>& v) {
  for (auto& x : v) i >> x;
  return i;
}

int main() {
  ios::sync_with_stdio(false);
  int n;
  string s;
  cin >> n >> s;
  unordered_set<char> p {'n'};
  for (char c : s) {
    unordered_set<char> q;
    if (p.count('a') || p.count('o') || p.count('n')) {
      q.insert('w');
      q.insert('n');
    }
    if (p.count('w')) {
      q.insert('a');
      q.insert('o');
    }
    if (q.empty() || (c != '?' && !q.count(c))) {
      cout << "No" << endl;
      return 0;
    }
    p.clear();
    if (c == '?') p = q;
    else p.insert(c);
  }
   
  cout << ((p.count('a') || p.count('o') || p.count('n')) ? "Yes" : "No") << endl;
  return 0;
}

0