結果

問題 No.2715 Unique Chimatagram
ユーザー dp_ijkdp_ijk
提出日時 2024-04-05 21:50:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 722 bytes
コンパイル時間 145 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 81,648 KB
最終ジャッジ日時 2024-04-05 21:50:44
合計ジャッジ時間 4,782 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
55,604 KB
testcase_01 AC 40 ms
55,604 KB
testcase_02 AC 35 ms
55,604 KB
testcase_03 AC 35 ms
55,604 KB
testcase_04 AC 36 ms
55,604 KB
testcase_05 AC 35 ms
55,604 KB
testcase_06 AC 36 ms
55,604 KB
testcase_07 AC 36 ms
55,604 KB
testcase_08 AC 88 ms
80,244 KB
testcase_09 AC 87 ms
80,120 KB
testcase_10 AC 101 ms
80,116 KB
testcase_11 AC 88 ms
80,888 KB
testcase_12 AC 86 ms
80,240 KB
testcase_13 AC 88 ms
80,120 KB
testcase_14 AC 108 ms
80,120 KB
testcase_15 AC 86 ms
80,248 KB
testcase_16 AC 88 ms
80,120 KB
testcase_17 AC 95 ms
80,372 KB
testcase_18 AC 84 ms
81,648 KB
testcase_19 AC 83 ms
81,520 KB
testcase_20 AC 83 ms
81,648 KB
testcase_21 AC 99 ms
81,648 KB
testcase_22 AC 88 ms
81,648 KB
testcase_23 AC 84 ms
81,520 KB
testcase_24 AC 83 ms
81,648 KB
testcase_25 AC 107 ms
81,648 KB
testcase_26 AC 85 ms
81,520 KB
testcase_27 AC 84 ms
81,648 KB
testcase_28 AC 93 ms
77,300 KB
testcase_29 AC 106 ms
76,400 KB
testcase_30 AC 93 ms
77,044 KB
testcase_31 AC 81 ms
76,400 KB
testcase_32 AC 110 ms
77,168 KB
testcase_33 AC 36 ms
55,604 KB
testcase_34 AC 36 ms
55,604 KB
testcase_35 AC 36 ms
55,604 KB
testcase_36 AC 35 ms
55,604 KB
testcase_37 AC 49 ms
55,604 KB
testcase_38 AC 50 ms
64,432 KB
testcase_39 AC 109 ms
77,176 KB
testcase_40 AC 93 ms
76,672 KB
testcase_41 AC 121 ms
79,736 KB
testcase_42 AC 103 ms
77,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
from bisect import bisect_left, bisect_right, insort


def ch_gen(start="a", stop="z"):
   for i in range(ord(start), ord(stop) + 1):
      yield chr(i)


ABC = [*ch_gen()]

N = int(input())
S = []
for _ in range(N):
   s = sorted(input())
   S.append(s)

C = Counter()
for s in S:
   for ch in ABC:
      insort(s, ch)
      u = "".join(s)
      C[u] += 1
      s.remove(ch)

for s in S:
   pool = []
   for ch in ABC:
      insort(s, ch)
      u = "".join(s)
      pool.append(u)
      s.remove(ch)
   for u in pool:
      C[u] -= 1
      if C[u] == 0:
         del C[u]
   for u in pool:
      if C[u] == 0:
         print(u)
         exit()
   for u in pool:
      C[u] += 1

print(-1)
0