結果

問題 No.3196 Unique Nickname
コンテスト
ユーザー M
提出日時 2025-07-12 10:38:47
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 94 ms / 2,000 ms
+ 473µs
コード長 438 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 926 ms
コンパイル使用メモリ 21,408 KB
実行使用メモリ 15,868 KB
最終ジャッジ日時 2026-07-13 04:44:59
合計ジャッジ時間 3,496 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n = int(input())

st = [input().split() for _ in range(n)]

dic = {}
for i in range(n):
    if st[i][0] not in dic:
        dic[st[i][0]] = 1
    else:
        dic[st[i][0]] += 1
    if st[i][1] not in dic:
        dic[st[i][1]] = 1
    else:
        dic[st[i][1]] += 1
        
flag = True
for s, t in st:
    if dic[s] == 1 or dic[t] == 1:
        flag = True
    else:
        flag = False
        break

print("Yes" if flag else "No")
0