結果

問題 No.938 賢人を探せ
ユーザー 👑 tamatotamato
提出日時 2019-12-01 11:00:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 138 ms / 2,000 ms
コード長 302 bytes
コンパイル時間 654 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 85,756 KB
最終ジャッジ日時 2023-08-21 03:29:26
合計ジャッジ時間 4,423 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
85,756 KB
testcase_01 AC 97 ms
71,640 KB
testcase_02 AC 97 ms
71,668 KB
testcase_03 AC 96 ms
71,716 KB
testcase_04 AC 96 ms
71,584 KB
testcase_05 AC 97 ms
71,720 KB
testcase_06 AC 97 ms
71,656 KB
testcase_07 AC 95 ms
71,840 KB
testcase_08 AC 121 ms
80,544 KB
testcase_09 AC 122 ms
81,000 KB
testcase_10 AC 95 ms
71,860 KB
testcase_11 AC 125 ms
81,584 KB
testcase_12 AC 125 ms
81,056 KB
testcase_13 AC 126 ms
81,016 KB
testcase_14 AC 125 ms
80,976 KB
testcase_15 AC 127 ms
80,852 KB
testcase_16 AC 127 ms
80,960 KB
testcase_17 AC 129 ms
80,916 KB
testcase_18 AC 129 ms
81,000 KB
testcase_19 AC 126 ms
81,148 KB
testcase_20 AC 127 ms
81,192 KB
testcase_21 AC 126 ms
81,144 KB
testcase_22 AC 138 ms
85,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import defaultdict
input = sys.stdin.readline

N = int(input())
ok = defaultdict(int)
B = []
for _ in range(N):
    a, b = input().split()
    ok[a] = -1
    if ok[b] == 0:
        ok[b] = 1
    B.append(b)

for b in B:
    if ok[b] == 1:
        print(b)
        ok[b] = 0
0