結果

問題 No.2373 wa, wo, n
ユーザー 👑 kakel-sankakel-san
提出日時 2023-07-07 21:54:12
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 1,226 bytes
コンパイル時間 1,886 ms
コンパイル使用メモリ 65,628 KB
実行使用メモリ 23,256 KB
最終ジャッジ日時 2023-09-28 23:04:14
合計ジャッジ時間 5,335 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
20,532 KB
testcase_01 AC 56 ms
20,628 KB
testcase_02 AC 54 ms
20,532 KB
testcase_03 AC 55 ms
20,524 KB
testcase_04 AC 55 ms
22,628 KB
testcase_05 AC 55 ms
20,584 KB
testcase_06 AC 56 ms
20,532 KB
testcase_07 AC 55 ms
22,668 KB
testcase_08 AC 56 ms
22,712 KB
testcase_09 AC 56 ms
20,704 KB
testcase_10 AC 55 ms
20,580 KB
testcase_11 AC 55 ms
20,724 KB
testcase_12 AC 54 ms
18,660 KB
testcase_13 AC 56 ms
20,608 KB
testcase_14 AC 62 ms
21,004 KB
testcase_15 AC 57 ms
20,776 KB
testcase_16 AC 62 ms
19,104 KB
testcase_17 AC 58 ms
20,728 KB
testcase_18 AC 58 ms
20,732 KB
testcase_19 AC 58 ms
20,620 KB
testcase_20 AC 59 ms
23,084 KB
testcase_21 AC 57 ms
20,508 KB
testcase_22 AC 58 ms
20,688 KB
testcase_23 AC 59 ms
21,188 KB
testcase_24 AC 54 ms
20,656 KB
testcase_25 AC 54 ms
20,744 KB
testcase_26 AC 54 ms
22,692 KB
testcase_27 AC 55 ms
22,776 KB
testcase_28 AC 55 ms
20,560 KB
testcase_29 AC 54 ms
18,584 KB
testcase_30 AC 55 ms
20,704 KB
testcase_31 AC 55 ms
18,604 KB
testcase_32 AC 62 ms
21,164 KB
testcase_33 AC 60 ms
21,288 KB
testcase_34 AC 59 ms
21,184 KB
testcase_35 AC 59 ms
21,264 KB
testcase_36 AC 62 ms
21,324 KB
testcase_37 AC 61 ms
21,200 KB
testcase_38 AC 62 ms
21,232 KB
testcase_39 AC 61 ms
21,264 KB
testcase_40 AC 63 ms
23,256 KB
testcase_41 AC 64 ms
21,196 KB
testcase_42 AC 59 ms
23,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var s = ReadLine();
        WriteLine(Wawon(n, s) ? "Yes" : "No");
    }
    static bool Wawon(int n, string _s)
    {
        var s = _s.ToCharArray();
        for (var i = 0; i < n; ++i)
        {
            if (s[i] == 'w')
            {
                if (i + 1 == n) return false;
                if (s[i + 1] == '?') s[i + 1] = 'a';
            }
            else if (s[i] == 'a' || s[i] == 'o')
            {
                if (i == 0) return false;
                if (s[i - 1] == '?') s[i - 1] = 'w';
            }
        }
        for (var i = 0; i < n; ++i)
        {
            if (s[i] == 'w')
            {
                if (s[i + 1] != 'a' && s[i + 1] != 'o') return false;
                ++i;
            }
            else if (s[i] != '?' && s[i] != 'n') return false;
        }
        return true;
    }
}
0