結果

問題 No.2715 Unique Chimatagram
ユーザー detteiuudetteiuu
提出日時 2024-04-11 00:36:25
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 733 bytes
コンパイル時間 233 ms
コンパイル使用メモリ 82,496 KB
実行使用メモリ 83,956 KB
最終ジャッジ日時 2024-04-11 00:36:37
合計ジャッジ時間 9,679 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
60,612 KB
testcase_01 AC 39 ms
59,176 KB
testcase_02 AC 39 ms
58,644 KB
testcase_03 AC 34 ms
53,044 KB
testcase_04 AC 33 ms
53,400 KB
testcase_05 AC 33 ms
53,064 KB
testcase_06 AC 36 ms
52,472 KB
testcase_07 AC 34 ms
52,252 KB
testcase_08 AC 48 ms
63,952 KB
testcase_09 AC 50 ms
65,772 KB
testcase_10 AC 48 ms
64,020 KB
testcase_11 AC 48 ms
64,560 KB
testcase_12 AC 49 ms
64,004 KB
testcase_13 AC 49 ms
64,684 KB
testcase_14 AC 61 ms
70,980 KB
testcase_15 AC 57 ms
69,672 KB
testcase_16 AC 50 ms
64,264 KB
testcase_17 AC 57 ms
64,736 KB
testcase_18 AC 61 ms
66,972 KB
testcase_19 AC 53 ms
66,124 KB
testcase_20 AC 55 ms
66,972 KB
testcase_21 AC 58 ms
67,236 KB
testcase_22 AC 56 ms
68,124 KB
testcase_23 AC 56 ms
67,432 KB
testcase_24 AC 55 ms
66,500 KB
testcase_25 AC 53 ms
66,580 KB
testcase_26 AC 57 ms
66,664 KB
testcase_27 AC 61 ms
67,232 KB
testcase_28 AC 176 ms
76,356 KB
testcase_29 AC 94 ms
76,660 KB
testcase_30 AC 124 ms
76,340 KB
testcase_31 AC 93 ms
76,472 KB
testcase_32 AC 299 ms
76,592 KB
testcase_33 AC 36 ms
52,412 KB
testcase_34 AC 40 ms
59,796 KB
testcase_35 AC 42 ms
59,628 KB
testcase_36 AC 37 ms
52,628 KB
testcase_37 AC 37 ms
53,068 KB
testcase_38 AC 57 ms
72,452 KB
testcase_39 AC 1,404 ms
76,848 KB
testcase_40 AC 146 ms
76,280 KB
testcase_41 AC 394 ms
76,764 KB
testcase_42 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = [input() for _ in range(N)]

cnt = [[0]*26 for _ in range(N)]
for i in range(N):
    for j in range(len(S[i])):
        cnt[i][ord(S[i][j])-ord("a")] += 1

def check(C, A):
    flag = False
    for i in range(26):
        if C[i] != A[i]:
            if flag:
                return False
            elif C[i]+1 == A[i]:
                flag = True
            else:
                return False
    return flag

for i in range(N):
    A = cnt[i][:]
    for j in range(26):
        A[j] += 1
        c = 0
        for k in range(N):
            if len(S[i]) == len(S[k]) and check(cnt[k], A):
                c += 1
        if c == 1:
            exit(print(S[i] + chr(j+ord("a"))))
        A[j] -= 1

print(-1)
0