結果

問題 No.3196 Unique Nickname
ユーザー u_kun
提出日時 2025-07-24 21:30:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 423 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 82,340 KB
実行使用メモリ 55,652 KB
最終ジャッジ日時 2025-07-24 21:30:34
合計ジャッジ時間 2,163 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter

N = int(input())

W_list = []
S_list = []
T_list = []

for _ in range(N):
    S, T = input().split()
    W_list.append(S)
    W_list.append(T)
    
    S_list.append(S)
    T_list.append(T)

W_cnt = Counter(W_list)

for i in range(N):
    S = S_list[i]
    T = T_list[i]
    
    if W_cnt[S] == 1 or W_cnt[T] == 1:
        continue
    else:
        print("No")
        exit()

print("Yes")
0