結果

問題 No.1367 文字列門松
ユーザー O2MTO2MT
提出日時 2021-02-06 18:02:03
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 989 bytes
コンパイル時間 691 ms
コンパイル使用メモリ 86,704 KB
実行使用メモリ 71,472 KB
最終ジャッジ日時 2023-09-16 04:10:10
合計ジャッジ時間 4,240 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,276 KB
testcase_01 AC 75 ms
71,404 KB
testcase_02 AC 77 ms
71,272 KB
testcase_03 AC 74 ms
71,168 KB
testcase_04 AC 76 ms
71,260 KB
testcase_05 AC 75 ms
71,128 KB
testcase_06 AC 74 ms
71,228 KB
testcase_07 AC 75 ms
71,028 KB
testcase_08 AC 74 ms
71,284 KB
testcase_09 AC 73 ms
71,472 KB
testcase_10 WA -
testcase_11 AC 73 ms
71,360 KB
testcase_12 AC 74 ms
71,408 KB
testcase_13 AC 75 ms
71,184 KB
testcase_14 AC 72 ms
71,172 KB
testcase_15 AC 77 ms
71,404 KB
testcase_16 AC 73 ms
71,164 KB
testcase_17 AC 74 ms
71,448 KB
testcase_18 AC 75 ms
71,228 KB
testcase_19 AC 74 ms
71,148 KB
testcase_20 AC 76 ms
71,184 KB
testcase_21 AC 74 ms
71,272 KB
testcase_22 AC 75 ms
71,172 KB
testcase_23 AC 75 ms
71,196 KB
testcase_24 AC 74 ms
71,028 KB
testcase_25 AC 77 ms
71,184 KB
testcase_26 AC 73 ms
71,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = str(input())
M = {'k':0,'a':[],'d':0,'o':0,'m':0,'t':0,'s':0,'u':0}
J = {'k':1,'a':[2,6],'d':3,'o':4,'m':5,'t':7,'s':8,'u':9}
KADOMATSU = "kadomatsu"
num = 0
l = ['']*11
ans = "Yes"
for s in S:
    num += 1
    if s in KADOMATSU:
        if s == 'a':
            len_a = len(M[s])
            if len_a < 2:
                M[s].append(num)
                l[num] = s
            else:
                ans = "No"
                break
        else:
            if M[s] == 0:
                M[s] = num
                l[num] = s
            else:
                ans = "No"
                break
    else:
        ans = "No"
        break
if ans == "Yes":
    S = ''.join(l)
    now = 0
    count_a = 0
    for s in S:
        if s == 'a':
            if J[s][count_a] < now:
                ans = "No"
            now = J[s][count_a]
            count_a += 1
        else:
            if J[s] < now:
                ans = "No"
            now = J[s]
    print(ans)
else:
    print(ans)
0