結果
問題 | No.145 yukiover |
ユーザー |
|
提出日時 | 2016-12-27 18:36:10 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 168 ms / 5,000 ms |
コード長 | 750 bytes |
コンパイル時間 | 227 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-12-15 03:50:00 |
合計ジャッジ時間 | 3,336 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
#!/usr/bin/env python3import collections# abcdefghijklmnopqrstuvwxyz# 4 3 2 1_ = int(input())cnt = collections.Counter()for c in input():cnt[c] += 1def take(c, z=None):if z is None:z = cwhile c <= z:if cnt[c]:cnt[c] -= 1return cc = 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] += 1return Falseelse:return Trueans = 0for s in [ 'yukiA', 'yukJ', 'yuL', 'yV', 'Z' ]:while construct(s):ans += 1print(ans)