結果

問題 No.938 賢人を探せ
ユーザー pekempeypekempey
提出日時 2019-12-01 00:05:37
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 160 ms / 2,000 ms
コード長 295 bytes
コンパイル時間 389 ms
コンパイル使用メモリ 87,140 KB
実行使用メモリ 82,268 KB
最終ジャッジ日時 2023-08-21 03:25:02
合計ジャッジ時間 4,599 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 160 ms
81,676 KB
testcase_01 AC 96 ms
71,848 KB
testcase_02 AC 93 ms
71,572 KB
testcase_03 AC 95 ms
71,660 KB
testcase_04 AC 95 ms
71,624 KB
testcase_05 AC 93 ms
71,736 KB
testcase_06 AC 93 ms
71,540 KB
testcase_07 AC 95 ms
71,792 KB
testcase_08 AC 143 ms
79,580 KB
testcase_09 AC 145 ms
80,172 KB
testcase_10 AC 95 ms
71,548 KB
testcase_11 AC 148 ms
80,244 KB
testcase_12 AC 149 ms
79,444 KB
testcase_13 AC 149 ms
79,764 KB
testcase_14 AC 146 ms
79,712 KB
testcase_15 AC 147 ms
79,820 KB
testcase_16 AC 145 ms
80,004 KB
testcase_17 AC 151 ms
79,780 KB
testcase_18 AC 150 ms
79,780 KB
testcase_19 AC 146 ms
79,832 KB
testcase_20 AC 147 ms
79,756 KB
testcase_21 AC 149 ms
79,812 KB
testcase_22 AC 158 ms
82,268 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

N = int(input())
st = set()
st2 = set()
ls = []
k = 0

for i in range(N):
  s, t = input().split()
  if s not in st:
    st.add(s)
    ls.append(s)
  if t not in st:
    st.add(t)
    ls.append(t)
  st2.add(s)

for x in ls:
  if x not in st2:
    print(x)


0