結果

問題 No.145 yukiover
ユーザー kimiyukikimiyuki
提出日時 2016-12-27 18:36:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 131 ms / 5,000 ms
コード長 750 bytes
コンパイル時間 561 ms
コンパイル使用メモリ 10,804 KB
実行使用メモリ 8,752 KB
最終ジャッジ日時 2023-08-21 15:08:39
合計ジャッジ時間 3,016 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,552 KB
testcase_01 AC 18 ms
8,620 KB
testcase_02 AC 18 ms
8,484 KB
testcase_03 AC 18 ms
8,548 KB
testcase_04 AC 18 ms
8,524 KB
testcase_05 AC 19 ms
8,516 KB
testcase_06 AC 19 ms
8,632 KB
testcase_07 AC 18 ms
8,504 KB
testcase_08 AC 18 ms
8,636 KB
testcase_09 AC 19 ms
8,456 KB
testcase_10 AC 18 ms
8,544 KB
testcase_11 AC 47 ms
8,656 KB
testcase_12 AC 118 ms
8,564 KB
testcase_13 AC 109 ms
8,664 KB
testcase_14 AC 131 ms
8,612 KB
testcase_15 AC 123 ms
8,612 KB
testcase_16 AC 126 ms
8,568 KB
testcase_17 AC 122 ms
8,752 KB
testcase_18 AC 114 ms
8,652 KB
testcase_19 AC 120 ms
8,560 KB
testcase_20 AC 116 ms
8,676 KB
testcase_21 AC 120 ms
8,668 KB
testcase_22 AC 122 ms
8,536 KB
testcase_23 AC 63 ms
8,564 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
import collections
# abcdefghijklmnopqrstuvwxyz
#         4 3         2   1
_ = int(input())
cnt = collections.Counter()
for c in input():
    cnt[c] += 1
def take(c, z=None):
    if z is None:
        z = c
    while c <= z:
        if cnt[c]:
            cnt[c] -= 1
            return c
        c = chr(ord(c) + 1)
    return ''
def construct(s):
    acc = ''
    for c in s:
        if c.islower():
            acc += take(c)
        elif c.isupper():
            acc += take(c.lower(), 'z')
    if len(acc) < len(s):
        for c in acc:
            cnt[c] += 1
        return False
    else:
        return True
ans = 0
for s in [ 'yukiA', 'yukJ', 'yuL', 'yV', 'Z' ]:
    while construct(s):
        ans += 1
print(ans)
0