結果

問題 No.2715 Unique Chimatagram
ユーザー kk0414kk0414
提出日時 2024-04-09 22:51:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 851 bytes
コンパイル時間 242 ms
コンパイル使用メモリ 82,444 KB
実行使用メモリ 77,704 KB
最終ジャッジ日時 2024-04-09 22:51:59
合計ジャッジ時間 8,688 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,160 KB
testcase_01 AC 37 ms
53,672 KB
testcase_02 AC 36 ms
53,140 KB
testcase_03 AC 37 ms
52,248 KB
testcase_04 AC 36 ms
53,060 KB
testcase_05 AC 37 ms
52,820 KB
testcase_06 AC 37 ms
53,012 KB
testcase_07 AC 40 ms
53,148 KB
testcase_08 AC 234 ms
76,828 KB
testcase_09 AC 427 ms
76,924 KB
testcase_10 AC 132 ms
76,740 KB
testcase_11 AC 118 ms
76,680 KB
testcase_12 WA -
testcase_13 AC 201 ms
76,820 KB
testcase_14 AC 173 ms
77,376 KB
testcase_15 AC 100 ms
76,784 KB
testcase_16 AC 126 ms
76,912 KB
testcase_17 AC 96 ms
76,552 KB
testcase_18 AC 57 ms
69,232 KB
testcase_19 AC 57 ms
68,816 KB
testcase_20 AC 61 ms
68,604 KB
testcase_21 AC 58 ms
69,192 KB
testcase_22 AC 58 ms
68,752 KB
testcase_23 AC 58 ms
69,676 KB
testcase_24 AC 58 ms
68,888 KB
testcase_25 AC 57 ms
68,596 KB
testcase_26 AC 58 ms
68,340 KB
testcase_27 AC 59 ms
70,400 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 37 ms
52,560 KB
testcase_34 AC 37 ms
53,040 KB
testcase_35 AC 37 ms
52,960 KB
testcase_36 AC 35 ms
53,000 KB
testcase_37 AC 37 ms
54,148 KB
testcase_38 AC 50 ms
62,732 KB
testcase_39 AC 213 ms
77,076 KB
testcase_40 AC 82 ms
77,184 KB
testcase_41 AC 719 ms
76,752 KB
testcase_42 AC 246 ms
76,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
L = [[0]*26 for _ in range(N)]
cand = []
for i in range(N):
    s = input()
    cand.append(s)
    for si in s:
        j = ord(si)-ord("a")
        L[i][j] += 1

for i in range(N):
    OK = [False] * N
    OK[i] = True
    skips = set()
    for j in range(N):
        if i==j:continue
        flag = False
        NG = []
        for k in range(26):
            if L[j][k] > L[i][k]:
                flag = True
                NG.append(k)
        OK[j] = flag
        if len(NG)==1 and L[j][NG[0]] - L[i][NG[0]] == 1:
            skips.add(NG[0])
    if all(OK) and len(skips) < 26: break

if not all(OK):
    print("-1")
else:
    if len(skips) == 26:
        print("-1")
    else:
        for x in range(26):
            if not x in skips:
                break
        ans = cand[i] + chr(x+ord("a"))
        print(ans)
        
0