結果

問題 No.2373 wa, wo, n
ユーザー 👑 timitimi
提出日時 2023-07-08 18:55:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 165 ms / 2,000 ms
コード長 442 bytes
コンパイル時間 1,433 ms
コンパイル使用メモリ 86,904 KB
実行使用メモリ 114,464 KB
最終ジャッジ日時 2023-09-29 20:13:36
合計ジャッジ時間 8,067 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,344 KB
testcase_01 AC 69 ms
71,244 KB
testcase_02 AC 71 ms
71,388 KB
testcase_03 AC 68 ms
70,960 KB
testcase_04 AC 70 ms
71,172 KB
testcase_05 AC 70 ms
71,392 KB
testcase_06 AC 69 ms
71,168 KB
testcase_07 AC 69 ms
71,344 KB
testcase_08 AC 69 ms
71,252 KB
testcase_09 AC 69 ms
71,272 KB
testcase_10 AC 69 ms
70,960 KB
testcase_11 AC 69 ms
71,052 KB
testcase_12 AC 70 ms
71,396 KB
testcase_13 AC 68 ms
71,176 KB
testcase_14 AC 148 ms
98,464 KB
testcase_15 AC 103 ms
81,484 KB
testcase_16 AC 154 ms
101,136 KB
testcase_17 AC 111 ms
83,912 KB
testcase_18 AC 92 ms
76,256 KB
testcase_19 AC 109 ms
86,084 KB
testcase_20 AC 133 ms
97,816 KB
testcase_21 AC 109 ms
84,992 KB
testcase_22 AC 118 ms
90,384 KB
testcase_23 AC 141 ms
100,772 KB
testcase_24 AC 70 ms
71,180 KB
testcase_25 AC 71 ms
71,248 KB
testcase_26 AC 69 ms
71,308 KB
testcase_27 AC 69 ms
71,176 KB
testcase_28 AC 71 ms
71,356 KB
testcase_29 AC 69 ms
71,396 KB
testcase_30 AC 72 ms
71,344 KB
testcase_31 AC 70 ms
71,104 KB
testcase_32 AC 165 ms
103,788 KB
testcase_33 AC 148 ms
103,484 KB
testcase_34 AC 158 ms
114,464 KB
testcase_35 AC 98 ms
79,856 KB
testcase_36 AC 124 ms
96,424 KB
testcase_37 AC 115 ms
93,436 KB
testcase_38 AC 116 ms
93,312 KB
testcase_39 AC 143 ms
107,628 KB
testcase_40 AC 141 ms
96,460 KB
testcase_41 AC 155 ms
102,640 KB
testcase_42 AC 140 ms
107,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
S=input()
D={}
for i in range(N):
  if S[i]=='?' or S[i]=='n':
    if i not in D:
      D[i]=[]
    D[i].append(i+1)

for i in range(N-1):
  a=S[i:i+2]
  if a=='wa' or a=='wo' or a=='w?' or a=='?o' or a=='?a' or a=='??':
    if i not in D:
      D[i]=[]
    D[i].append(i+2)
dp=[-1]*(N+1)
dp[0]=1
for i in range(N):
  if i in D and dp[i]==1:
    for nex in D[i]:
      dp[nex]=1
if dp[-1]==1:
  print('Yes')
else:
  print('No')
0