結果
問題 |
No.1643 Not Substring
|
ユーザー |
![]() |
提出日時 | 2025-04-09 20:56:09 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 39 ms / 2,000 ms |
コード長 | 549 bytes |
コンパイル時間 | 325 ms |
コンパイル使用メモリ | 82,632 KB |
実行使用メモリ | 53,812 KB |
最終ジャッジ日時 | 2025-04-09 20:57:43 |
合計ジャッジ時間 | 2,421 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 26 |
ソースコード
s = input().strip() counts = {} for c in 'abcdefghijklmnopqrstuvwxyz': counts[c] = 0 for ch in s: counts[ch] += 1 candidates = [] for c in 'abcdefghijklmnopqrstuvwxyz': k = counts[c] candidates.append(c * (k + 1)) def is_subsequence(t, s): it = 0 for ch in t: pos = s.find(ch, it) if pos == -1: return False it = pos + 1 return True valid = [] for candidate in candidates: if not is_subsequence(candidate, s): valid.append(candidate) print(min(valid) if valid else '')