結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,460 KB
testcase_01 AC 40 ms
53,460 KB
testcase_02 AC 40 ms
53,460 KB
testcase_03 WA -
testcase_04 AC 39 ms
53,460 KB
testcase_05 AC 40 ms
53,460 KB
testcase_06 AC 40 ms
53,460 KB
testcase_07 AC 40 ms
53,460 KB
testcase_08 AC 68 ms
68,568 KB
testcase_09 WA -
testcase_10 AC 75 ms
70,652 KB
testcase_11 AC 74 ms
70,644 KB
testcase_12 AC 72 ms
70,644 KB
testcase_13 AC 70 ms
70,644 KB
testcase_14 AC 79 ms
73,244 KB
testcase_15 AC 82 ms
73,764 KB
testcase_16 AC 68 ms
68,568 KB
testcase_17 AC 66 ms
70,644 KB
testcase_18 AC 73 ms
70,644 KB
testcase_19 AC 70 ms
70,644 KB
testcase_20 AC 69 ms
70,652 KB
testcase_21 AC 68 ms
70,652 KB
testcase_22 AC 67 ms
70,652 KB
testcase_23 AC 68 ms
70,652 KB
testcase_24 AC 68 ms
70,644 KB
testcase_25 AC 69 ms
70,652 KB
testcase_26 AC 67 ms
70,644 KB
testcase_27 AC 70 ms
70,652 KB
testcase_28 AC 95 ms
76,292 KB
testcase_29 AC 82 ms
76,048 KB
testcase_30 AC 84 ms
76,044 KB
testcase_31 AC 74 ms
72,728 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 39 ms
53,460 KB
testcase_35 AC 39 ms
53,460 KB
testcase_36 AC 40 ms
53,460 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 90 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]:c1=True
                if cnt1[k]>cnt2[k]:c2=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