結果

問題 No.2240 WAC
ユーザー flygonflygon
提出日時 2023-03-10 21:35:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 673 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 81,692 KB
実行使用メモリ 80,976 KB
最終ジャッジ日時 2023-10-18 07:17:35
合計ジャッジ時間 3,936 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
55,632 KB
testcase_01 AC 43 ms
55,632 KB
testcase_02 AC 43 ms
55,632 KB
testcase_03 AC 44 ms
55,632 KB
testcase_04 AC 44 ms
55,632 KB
testcase_05 AC 44 ms
55,632 KB
testcase_06 AC 44 ms
55,632 KB
testcase_07 AC 44 ms
55,632 KB
testcase_08 AC 44 ms
55,632 KB
testcase_09 AC 45 ms
55,632 KB
testcase_10 AC 84 ms
80,976 KB
testcase_11 AC 76 ms
76,728 KB
testcase_12 AC 76 ms
79,428 KB
testcase_13 AC 44 ms
55,884 KB
testcase_14 AC 60 ms
68,028 KB
testcase_15 AC 45 ms
56,160 KB
testcase_16 AC 79 ms
77,692 KB
testcase_17 AC 76 ms
78,372 KB
testcase_18 AC 61 ms
70,080 KB
testcase_19 AC 59 ms
72,112 KB
testcase_20 AC 45 ms
56,212 KB
testcase_21 AC 64 ms
73,548 KB
testcase_22 AC 45 ms
55,972 KB
testcase_23 AC 44 ms
55,884 KB
testcase_24 AC 46 ms
56,152 KB
testcase_25 AC 78 ms
78,392 KB
testcase_26 AC 61 ms
72,112 KB
testcase_27 AC 62 ms
70,084 KB
testcase_28 AC 44 ms
55,632 KB
testcase_29 AC 45 ms
55,632 KB
testcase_30 AC 45 ms
55,972 KB
testcase_31 AC 80 ms
78,204 KB
testcase_32 AC 61 ms
70,064 KB
testcase_33 AC 76 ms
79,328 KB
testcase_34 AC 77 ms
79,596 KB
testcase_35 AC 56 ms
65,948 KB
testcase_36 AC 77 ms
78,596 KB
testcase_37 AC 46 ms
56,300 KB
testcase_38 AC 45 ms
55,632 KB
testcase_39 AC 46 ms
56,432 KB
testcase_40 AC 75 ms
78,772 KB
testcase_41 AC 44 ms
56,096 KB
testcase_42 AC 45 ms
56,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd

n,m = map(int,input().split())
s = input().rstrip()


def f():
  quea = deque([])
  quew = deque([])
  for i,c in enumerate(s):
    if c == "A":
      quea.append(i)
    elif c == "C":
      if not quea:
        return False
      else:
        quea.popleft()
    else:
      quew.append(i)

  while quew:
    la = quea.popleft()
    lw = quew.popleft()
    if la < lw:
      return False
  return True

print('Yes') if f() else print('No')

  




0