結果

問題 No.2715 Unique Chimatagram
ユーザー kk0414
提出日時 2024-04-05 22:20:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 645 bytes
コンパイル時間 468 ms
コンパイル使用メモリ 82,096 KB
実行使用メモリ 78,804 KB
最終ジャッジ日時 2024-10-01 02:35:04
合計ジャッジ時間 16,497 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 7 WA * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

def conv(dl):
    res = ""
    cand = []
    for i,t in enumerate(dl):
        if t:
            a = chr(i+ord("a"))
            res += a
            cand.append(a)
    res += cand[0]
    return res

n = int(input())
dp = [[False]*26 for _ in range(n)]
cand = []

for i in range(n):
    ss = input()
    cand.append(ss)
    for si in ss:
        x = ord(si) - ord("a")
        dp[i][x] = True


for i in range(n):
    for j in range(26):
        if not dp[i][j]:
            c = [dp[k][j] for k in range(n) if k!=i]
            if all(c):
                ans = cand[i] + cand[i][0]
                print(ans)
                exit()
print("-1")
0