結果

問題 No.2240 WAC
ユーザー ああいいああいい
提出日時 2023-03-18 14:58:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 384 bytes
コンパイル時間 664 ms
コンパイル使用メモリ 81,680 KB
実行使用メモリ 75,816 KB
最終ジャッジ日時 2023-10-18 17:17:50
合計ジャッジ時間 4,201 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,504 KB
testcase_01 AC 36 ms
53,504 KB
testcase_02 WA -
testcase_03 AC 34 ms
53,504 KB
testcase_04 AC 37 ms
53,504 KB
testcase_05 AC 37 ms
53,504 KB
testcase_06 AC 38 ms
53,504 KB
testcase_07 AC 37 ms
53,504 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 56 ms
75,816 KB
testcase_11 AC 61 ms
75,740 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 58 ms
75,468 KB
testcase_17 WA -
testcase_18 AC 43 ms
69,788 KB
testcase_19 AC 45 ms
71,836 KB
testcase_20 WA -
testcase_21 AC 51 ms
75,124 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 53 ms
75,304 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 43 ms
67,740 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 52 ms
75,348 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
S = input()

import sys
a = 0
for s in S:
    if s == "a":
        a += 1
    elif s == "c":
        if a == 0:
            print('No')
            exit()
        else:
            a -= 1
w = 0
for s in reversed(S):
    if s == "a":a += 1
    elif s == "w":
        if a == 0:
            print('No')
            exit()
        else:a -= 1
print('Yes')
0