結果

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

ソースコード

diff #

from collections import Counter
N = int(input())
Ss = []
Ts = []
C = Counter()
for _ in range(N):
   S, T = input().split()
   Ss.append(S)
   Ts.append(T)
   C[S] += 1
   C[T] += 1


def proc():
   for i in range(N):
      S, T = Ss[i], Ts[i]
      C[S] -= 1
      C[T] -= 1
      if C[S] >= 1 and C[T] >= 1:
         return False
      C[S] += 1
      C[T] += 1
   return True


ans = proc()
print("Yes" if ans else "No")
0