結果

問題 No.145 yukiover
ユーザー titiatitia
提出日時 2022-03-10 00:52:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 215 ms / 5,000 ms
コード長 1,186 bytes
コンパイル時間 537 ms
コンパイル使用メモリ 10,900 KB
実行使用メモリ 8,828 KB
最終ジャッジ日時 2023-10-12 02:30:51
合計ジャッジ時間 3,267 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,540 KB
testcase_01 AC 18 ms
8,604 KB
testcase_02 AC 19 ms
8,656 KB
testcase_03 AC 19 ms
8,756 KB
testcase_04 AC 19 ms
8,564 KB
testcase_05 AC 18 ms
8,724 KB
testcase_06 AC 19 ms
8,680 KB
testcase_07 AC 18 ms
8,564 KB
testcase_08 AC 19 ms
8,576 KB
testcase_09 AC 18 ms
8,564 KB
testcase_10 AC 18 ms
8,724 KB
testcase_11 AC 25 ms
8,716 KB
testcase_12 AC 79 ms
8,636 KB
testcase_13 AC 103 ms
8,636 KB
testcase_14 AC 150 ms
8,820 KB
testcase_15 AC 215 ms
8,664 KB
testcase_16 AC 146 ms
8,636 KB
testcase_17 AC 112 ms
8,816 KB
testcase_18 AC 108 ms
8,656 KB
testcase_19 AC 110 ms
8,824 KB
testcase_20 AC 109 ms
8,712 KB
testcase_21 AC 111 ms
8,828 KB
testcase_22 AC 108 ms
8,712 KB
testcase_23 AC 38 ms
8,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter

N=int(input())
S=input().strip()

C=Counter(S)
ANS=0

ALL="abcdefghijklmnopqrstuvwxyz"
YUKI="yuki"

for i in range(10**6):
    #print(C)

    if C["y"]>0 and C["u"]>0 and C["k"]>0 and C["i"]>0:
        C["y"]-=1
        C["u"]-=1
        C["k"]-=1
        C["i"]-=1
        
        for s in ALL:
            if C[s]>0:
                C[s]-=1
                ANS+=1
                break

        continue

    if C["y"]>0 and C["u"]>0 and C["k"]>0:
        C["y"]-=1
        C["u"]-=1
        C["k"]-=1
        
        for s in ALL:
            if s>"i" and C[s]>0:
                C[s]-=1
                ANS+=1
                break

        continue

    if C["y"]>0 and C["u"]>0:
        C["y"]-=1
        C["u"]-=1
        
        for s in ALL:
            if s>"k" and C[s]>0:
                C[s]-=1
                ANS+=1
                break
        continue

    if C["y"]>0:
        C["y"]-=1
        
        for s in ALL:
            if s>"u" and C[s]>0:
                C[s]-=1
                ANS+=1
                break

        continue

    if C["z"]>0:
        C["z"]-=1
        ANS+=1
    else:
        break

    

print(ANS)
0