結果

問題 No.2373 wa, wo, n
ユーザー ninesnines
提出日時 2023-07-07 22:12:39
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 3,395 bytes
コンパイル時間 11,388 ms
コンパイル使用メモリ 562,192 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-09-28 23:33:23
合計ジャッジ時間 13,819 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")

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

#include <atcoder/all>
using namespace atcoder;

#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;
using Real = mp::number<mp::cpp_dec_float<1024>>;
using Rat = boost::rational<Bint>;

typedef long long ll;
const ll INF = 1e18;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = ll(a); i < ll(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define rrep(i, n) for (ll i = ll(n) - 1; i >= 0; --i)

#define all(v) v.begin(), v.end()
#define llpow(x, y) (ll) pow(x, y)
#define llacumulate(v) accumulate(all(v), 0LL)
#define endl "\n"
#define popcount __builtin_popcount

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vs = vector<string>;

void YN(bool b) { cout << (b ? "Yes" : "No") << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }

struct Fast
{
    Fast()
    {
        std::cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} fast;

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

template <typename T>
inline void print(const T &x)
{
    cout << x << "\n";
}
template <typename T>
inline void print(const vector<T> &v, string s = " ")
{
    rep(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");
}
template <typename T>
inline void print(const vector<vector<T>> &v)
{
    for (auto &&p : v)
        print(p);
}
template <typename T, typename S>
inline void print(const pair<T, S> &p)
{
    cout << p.first << " " << p.second << endl;
}
template <typename T, typename S>
inline void print(const vector<pair<T, S>> &v)
{
    for (auto &&p : v)
        print(p);
}

#ifdef LOCAL
#include <library/debug_print.hpp>
#define debug(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (static_cast<void>(0))
#endif

int main()
{
    ll n;
    string s;
    cin >> n >> s;

    bool flag = false;

    rep(i, s.size())
    {
        char x = s[i];
        if (x == 'w')
        {
            flag = true;
        }
        else if (x == 'a' || x == 'o')
        {
            if (flag)
                flag = false;
            else
            {
                if (i != 0 && s[i - 1] == '?')
                {
                    flag = false;
                }
                else
                {
                    No();
                    return 0;
                }
            }
        }
        else if (x == 'n')
        {
            if (flag)
            {
                No();
                return 0;
            }
        }
        else if (x == '?')
        {
            if(i!=0&&s[i-1]=='w'){
                s[i] = 'a';
            }
            flag = false;
        }
        else
        {
            No();
            return 0;
        }
    }
    Yes();
}
0