結果

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

ソースコード

diff #

from collections import defaultdict


def solve():
    N = int(input())
    all_names = defaultdict(int)

    names = [input().split() for _ in range(N)]

    for s, t in names:
        all_names[s] += 1
        all_names[t] += 1

    for s, t in names:
        if [s, t].count(s) == all_names[s]:
            continue
        elif [s, t].count(t) == all_names[t]:
            continue
        else:
            print("No")
            exit()

    print("Yes")


if __name__ == "__main__":
    solve()
0