結果

問題 No.2373 wa, wo, n
ユーザー traindoggotraindoggo
提出日時 2024-02-07 13:47:45
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,485 bytes
コンパイル時間 2,345 ms
コンパイル使用メモリ 202,552 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-02-07 13:47:49
合計ジャッジ時間 4,807 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#ifdef DEBUG_
#include <compe/debug.hpp>
#else
#define dump(...)
#endif

using llint = long long int;

#define FastIO cin.tie(nullptr), ios_base::sync_with_stdio(false);
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define out(msg) cout << (msg) << '\n'
#define die(msg)         \
  do {                   \
    cout << msg << endl; \
    exit(0);             \
  } while (0)
#define all(k) k.begin(), k.end()
#define rall(k) k.rbegin(), k.rend()
#define INFi 1 << 30
#define INFll 1LL << 60

template <typename T> bool chmax(T& a, const T& b) {
  return ((a < b) ? (a = b, true) : (false));
}
template <typename T> bool chmin(T& a, const T& b) {
  return ((a > b) ? (a = b, true) : false);
}

// wa, wo, n
int main() {
  FastIO;
  int n;
  string s;
  cin >> n >> s;

  // w? -> wa (fixed a)
  rep(i, n - 1) {
    if (s[i] == 'w' && s[i + 1] == '?') {
      s[i + 1] = 'a';
    }
  }
  dump(s);

  // ?a, ?o
  rep(i, n - 1) {
    if (s[i] == '?') {
      if (s[i + 1] == 'o' || s[i + 1] == 'a') {
        s[i] = 'w';
      }
    }
  }
  dump(s);

  rep(i, n) {
    if (s[i] == '?') s[i] = 'n';
  }
  dump(s);

  // delete n
  for (int i = n - 1; i >= 0; --i) {
    if (s[i] == 'n') s.erase(i);
  }
  dump(s);

  if (s.size() % 2 == 1) die("No");

  rep(i, (int)s.size() / 2) {
    char a = s[2 * i];
    char b = s[2 * i + 1];
    if (a == 'w' && (b == 'a' || b == 'o')) {
    } else {
      die("No");
    }
  }
  out("Yes");
}
0