結果
問題 |
No.2715 Unique Chimatagram
|
ユーザー |
![]() |
提出日時 | 2024-04-05 22:03:02 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 735 bytes |
コンパイル時間 | 284 ms |
コンパイル使用メモリ | 82,020 KB |
実行使用メモリ | 79,148 KB |
最終ジャッジ日時 | 2024-10-01 02:19:12 |
合計ジャッジ時間 | 7,711 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 WA * 6 |
ソースコード
import sys input = sys.stdin.readline from collections import Counter n=int(input()) S=[sorted(input().strip()) for i in range(n)] CS=[] for i in range(n): CS.append(Counter(S[i])) for i in range(n): if i+1<n and S[i]==S[i+1]: continue if i-1>=0 and S[i]==S[i-1]: continue for x in "abcdefghijklmnopqrstuvwxyz": T=S[i]+[x] C=Counter(T) flag=1 for j in range(n): if i==j: continue for s in Counter(CS[j]): if C[s]<CS[j][s]: break else: flag=0 break if flag==1: print("".join(T)) exit() print(-1)