結果
問題 | No.2715 Unique Chimatagram |
ユーザー | Theta |
提出日時 | 2024-04-10 15:13:21 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,151 bytes |
コンパイル時間 | 220 ms |
コンパイル使用メモリ | 82,460 KB |
実行使用メモリ | 79,872 KB |
最終ジャッジ日時 | 2024-04-10 15:13:35 |
合計ジャッジ時間 | 9,924 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 55 ms
64,128 KB |
testcase_01 | AC | 56 ms
64,000 KB |
testcase_02 | AC | 53 ms
63,872 KB |
testcase_03 | AC | 54 ms
63,744 KB |
testcase_04 | AC | 55 ms
65,664 KB |
testcase_05 | AC | 52 ms
64,000 KB |
testcase_06 | AC | 53 ms
63,872 KB |
testcase_07 | AC | 67 ms
63,872 KB |
testcase_08 | AC | 778 ms
79,316 KB |
testcase_09 | AC | 784 ms
79,720 KB |
testcase_10 | AC | 190 ms
79,308 KB |
testcase_11 | AC | 285 ms
79,396 KB |
testcase_12 | WA | - |
testcase_13 | AC | 339 ms
79,744 KB |
testcase_14 | AC | 300 ms
79,716 KB |
testcase_15 | AC | 161 ms
79,580 KB |
testcase_16 | AC | 354 ms
79,324 KB |
testcase_17 | AC | 177 ms
79,592 KB |
testcase_18 | AC | 111 ms
78,764 KB |
testcase_19 | AC | 110 ms
78,720 KB |
testcase_20 | AC | 108 ms
78,556 KB |
testcase_21 | AC | 107 ms
78,848 KB |
testcase_22 | AC | 108 ms
78,664 KB |
testcase_23 | AC | 106 ms
78,784 KB |
testcase_24 | AC | 130 ms
78,592 KB |
testcase_25 | AC | 132 ms
79,192 KB |
testcase_26 | AC | 109 ms
78,720 KB |
testcase_27 | AC | 114 ms
78,720 KB |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | AC | 54 ms
64,128 KB |
testcase_34 | AC | 50 ms
63,744 KB |
testcase_35 | AC | 49 ms
63,872 KB |
testcase_36 | AC | 50 ms
63,932 KB |
testcase_37 | AC | 49 ms
63,872 KB |
testcase_38 | AC | 51 ms
66,560 KB |
testcase_39 | AC | 110 ms
78,372 KB |
testcase_40 | AC | 105 ms
78,628 KB |
testcase_41 | AC | 99 ms
78,004 KB |
testcase_42 | AC | 97 ms
77,680 KB |
ソースコード
from collections import Counter from string import ascii_lowercase import sys def printe(*args, end="\n", **kwargs): print(*args, end=end, file=sys.stderr, **kwargs) def main(): N = int(input()) S = [input() for _ in range(N)] S_ctrs = list(map(Counter, S)) S_sorted = list(map(lambda elm: "".join(sorted(elm)), S)) S_cand = set() S_sorted_ctr = Counter(S_sorted) for sort_elm, elm in zip(S_sorted, S): if S_sorted_ctr[sort_elm] == 1: S_cand.add(elm) if not S_cand: print(-1) return for elm in S_cand: for add_letter in ascii_lowercase: tmp_ctr = Counter(elm) tmp_ctr[add_letter] += 1 for other_elm, other_ctr in zip(S, S_ctrs): tmp_tmp_ctr = tmp_ctr.copy() if other_elm == elm: continue tmp_tmp_ctr.subtract(other_ctr) if all(map(lambda elm: elm >= 0, tmp_tmp_ctr.values())): break else: print(elm + add_letter) return print(-1) if __name__ == "__main__": main()