結果

問題 No.2715 Unique Chimatagram
ユーザー kk0414kk0414
提出日時 2024-04-09 22:46:40
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 795 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 82,360 KB
実行使用メモリ 74,852 KB
最終ジャッジ日時 2024-04-09 22:46:47
合計ジャッジ時間 5,911 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
52,068 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 34 ms
52,560 KB
testcase_04 AC 35 ms
53,728 KB
testcase_05 AC 35 ms
52,904 KB
testcase_06 AC 38 ms
52,524 KB
testcase_07 AC 38 ms
52,928 KB
testcase_08 AC 64 ms
69,672 KB
testcase_09 AC 65 ms
71,952 KB
testcase_10 AC 97 ms
72,696 KB
testcase_11 AC 72 ms
71,852 KB
testcase_12 AC 60 ms
69,548 KB
testcase_13 AC 63 ms
70,540 KB
testcase_14 AC 66 ms
72,120 KB
testcase_15 AC 64 ms
71,604 KB
testcase_16 AC 63 ms
69,856 KB
testcase_17 AC 59 ms
70,712 KB
testcase_18 AC 54 ms
70,032 KB
testcase_19 AC 68 ms
74,708 KB
testcase_20 AC 53 ms
69,520 KB
testcase_21 AC 63 ms
72,768 KB
testcase_22 AC 78 ms
74,852 KB
testcase_23 AC 71 ms
74,020 KB
testcase_24 AC 66 ms
72,892 KB
testcase_25 AC 86 ms
74,100 KB
testcase_26 AC 85 ms
73,884 KB
testcase_27 AC 69 ms
73,860 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 32 ms
52,960 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 39 ms
52,556 KB
testcase_37 AC 39 ms
53,368 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
権限があれば一括ダウンロードができます

ソースコード

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
        for k in range(26):
            if L[j][k] > L[i][k]:
                flag = True
                if L[j][k] - L[i][k] == 1:
                    skips.add(k)
        OK[j] = True
    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