結果

問題 No.2715 Unique Chimatagram
ユーザー 👑 tipstar0125tipstar0125
提出日時 2024-04-05 22:05:59
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 992 bytes
コンパイル時間 588 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 76,684 KB
最終ジャッジ日時 2024-04-05 22:06:05
合計ジャッジ時間 4,963 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 37 ms
53,460 KB
testcase_02 AC 37 ms
53,460 KB
testcase_03 AC 37 ms
53,460 KB
testcase_04 AC 37 ms
53,460 KB
testcase_05 AC 37 ms
53,460 KB
testcase_06 AC 36 ms
53,460 KB
testcase_07 AC 36 ms
53,460 KB
testcase_08 AC 63 ms
68,568 KB
testcase_09 AC 71 ms
70,640 KB
testcase_10 AC 64 ms
70,652 KB
testcase_11 AC 64 ms
70,644 KB
testcase_12 AC 65 ms
70,644 KB
testcase_13 AC 64 ms
70,644 KB
testcase_14 AC 76 ms
73,372 KB
testcase_15 AC 77 ms
73,892 KB
testcase_16 AC 64 ms
68,568 KB
testcase_17 AC 64 ms
70,644 KB
testcase_18 AC 64 ms
70,644 KB
testcase_19 AC 66 ms
70,644 KB
testcase_20 AC 66 ms
70,652 KB
testcase_21 AC 64 ms
70,652 KB
testcase_22 AC 69 ms
70,652 KB
testcase_23 AC 63 ms
70,652 KB
testcase_24 AC 65 ms
70,644 KB
testcase_25 AC 65 ms
70,652 KB
testcase_26 AC 64 ms
70,644 KB
testcase_27 AC 69 ms
70,652 KB
testcase_28 AC 92 ms
76,292 KB
testcase_29 AC 79 ms
76,044 KB
testcase_30 AC 84 ms
76,044 KB
testcase_31 AC 70 ms
72,728 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 38 ms
53,460 KB
testcase_35 AC 36 ms
53,460 KB
testcase_36 AC 36 ms
53,460 KB
testcase_37 AC 36 ms
53,460 KB
testcase_38 AC 50 ms
63,936 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 84 ms
76,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

for i in range(N-1):
    cnt1=[0 for _ in range(26)]
    for c in S[i]:
        cnt1[ord(c)-ord("a")]+=1
    sum1=sum(cnt1)
    ok=[True for _ in range(26)]

    for j in range(i+1,N):
        cnt2=[0 for _ in range(26)]
        for c in S[j]:cnt2[ord(c)-ord("a")]+=1
        sum2=sum(cnt2)

        diff_cnt=0
        for k in range(26):
            diff_cnt+=abs(cnt1[k]-cnt2[k])
        
        if diff_cnt==0:
            for k in range(26):ok[k]=False
            break
        if diff_cnt==2 and sum1==sum2:
            b1=False
            b2=False
            for k in range(26):
                if cnt1[k]<cnt2[k]:b1=True
                if cnt1[k]>cnt2[k]:b2=True
            if b1 and b2:
                for k in range(26):
                    if cnt1[k]<cnt2[k]:ok[k]=False
    
    for n,b in enumerate(ok):
        if b:
            print("".join(S[i])+chr(n+ord("a")))
            exit(0)


print(-1)




        

        
0