結果

問題 No.938 賢人を探せ
ユーザー pekempeypekempey
提出日時 2019-12-01 00:05:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 111 ms / 2,000 ms
コード長 295 bytes
コンパイル時間 544 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 81,228 KB
最終ジャッジ日時 2024-05-08 08:52:16
合計ジャッジ時間 3,203 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
81,228 KB
testcase_01 AC 44 ms
53,376 KB
testcase_02 AC 42 ms
53,248 KB
testcase_03 AC 43 ms
53,376 KB
testcase_04 AC 43 ms
53,376 KB
testcase_05 AC 43 ms
53,760 KB
testcase_06 AC 43 ms
53,504 KB
testcase_07 AC 43 ms
53,376 KB
testcase_08 AC 97 ms
77,280 KB
testcase_09 AC 100 ms
77,824 KB
testcase_10 AC 43 ms
53,504 KB
testcase_11 AC 104 ms
78,400 KB
testcase_12 AC 102 ms
78,016 KB
testcase_13 AC 101 ms
77,576 KB
testcase_14 AC 102 ms
77,568 KB
testcase_15 AC 101 ms
77,696 KB
testcase_16 AC 103 ms
77,568 KB
testcase_17 AC 102 ms
77,952 KB
testcase_18 AC 106 ms
77,568 KB
testcase_19 AC 105 ms
77,696 KB
testcase_20 AC 103 ms
77,696 KB
testcase_21 AC 104 ms
77,696 KB
testcase_22 AC 109 ms
81,024 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