結果

問題 No.3196 Unique Nickname
ユーザー 👑 Kazun
提出日時 2025-07-11 22:23:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 388 bytes
コンパイル時間 312 ms
コンパイル使用メモリ 83,048 KB
実行使用メモリ 55,788 KB
最終ジャッジ日時 2025-07-11 22:23:50
合計ジャッジ時間 1,957 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    from collections import defaultdict

    N = int(input())
    S = [None] * N; T = [None] * N
    D = defaultdict(int)
    for i in range(N):
        S[i], T[i] = input().split()
        D[S[i]] += 1
        D[T[i]] += 1

    return all(D[S[i]] == 1 or D[T[i]] == 1 for i in range(N))

#==================================================
print("Yes" if solve() else "No")
0