結果

問題 No.2715 Unique Chimatagram
ユーザー detteiuudetteiuu
提出日時 2024-04-11 00:22:35
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 706 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 82,672 KB
実行使用メモリ 77,508 KB
最終ジャッジ日時 2024-04-11 00:22:48
合計ジャッジ時間 12,879 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
57,984 KB
testcase_01 AC 40 ms
58,368 KB
testcase_02 AC 43 ms
57,728 KB
testcase_03 AC 39 ms
52,352 KB
testcase_04 AC 38 ms
52,588 KB
testcase_05 AC 38 ms
52,352 KB
testcase_06 AC 39 ms
52,480 KB
testcase_07 AC 38 ms
52,224 KB
testcase_08 AC 57 ms
63,616 KB
testcase_09 AC 66 ms
68,608 KB
testcase_10 AC 57 ms
65,536 KB
testcase_11 AC 56 ms
65,920 KB
testcase_12 AC 54 ms
65,664 KB
testcase_13 AC 58 ms
64,640 KB
testcase_14 AC 80 ms
76,504 KB
testcase_15 AC 69 ms
76,440 KB
testcase_16 AC 58 ms
65,280 KB
testcase_17 AC 60 ms
65,536 KB
testcase_18 AC 59 ms
66,176 KB
testcase_19 AC 59 ms
65,408 KB
testcase_20 AC 63 ms
66,432 KB
testcase_21 AC 61 ms
66,304 KB
testcase_22 AC 58 ms
66,048 KB
testcase_23 AC 61 ms
66,176 KB
testcase_24 AC 57 ms
66,432 KB
testcase_25 AC 69 ms
64,896 KB
testcase_26 AC 67 ms
65,792 KB
testcase_27 AC 70 ms
66,432 KB
testcase_28 AC 609 ms
76,544 KB
testcase_29 AC 177 ms
76,784 KB
testcase_30 AC 375 ms
76,436 KB
testcase_31 AC 106 ms
76,368 KB
testcase_32 AC 1,307 ms
77,056 KB
testcase_33 AC 33 ms
52,476 KB
testcase_34 AC 39 ms
58,456 KB
testcase_35 AC 37 ms
59,060 KB
testcase_36 AC 34 ms
53,412 KB
testcase_37 AC 34 ms
52,620 KB
testcase_38 AC 53 ms
70,584 KB
testcase_39 AC 1,352 ms
76,840 KB
testcase_40 AC 161 ms
76,224 KB
testcase_41 TLE -
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 check(cnt[k], A):
                c += 1
        if c == 1:
            exit(print(S[i] + chr(j+ord("a"))))
        A[j] -= 1

print(-1)
0