結果
問題 | No.2373 wa, wo, n |
ユーザー |
![]() |
提出日時 | 2024-06-25 00:56:25 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 28 ms / 2,000 ms |
コード長 | 906 bytes |
コンパイル時間 | 2,841 ms |
コンパイル使用メモリ | 250,236 KB |
実行使用メモリ | 17,652 KB |
最終ジャッジ日時 | 2024-06-25 00:56:30 |
合計ジャッジ時間 | 4,303 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 39 |
ソースコード
#include <bits/stdc++.h>using namespace std;#ifdef LOCAL#include "settings/debug.cpp"#define _GLIBCXX_DEBUG#else#define Debug(...) void(0)#endif#define rep(i, n) for (int i = 0; i < (n); ++i)using ll = long long;using ull = unsigned long long;int main() {int n;string s;cin >> n >> s;vector dp(n + 1, vector<bool>(2, false));dp[0][0] = true;rep(i, n) {switch (s[i]) {case 'w':if (dp[i][0]) dp[i + 1][1] = true;break;case 'a':if (dp[i][1]) dp[i + 1][0] = true;break;case 'o':if (dp[i][1]) dp[i + 1][0] = true;break;case 'n':if (dp[i][0]) dp[i + 1][0] = true;break;case '?':if (dp[i][0]) dp[i + 1][0] = dp[i + 1][1] = true;if (dp[i][1]) dp[i + 1][0] = true;break;}}cout << (dp[n][0] ? "Yes" : "No") << endl;return 0;}