結果

問題 No.938 賢人を探せ
ユーザー tamatotamato
提出日時 2019-12-01 11:00:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 302 bytes
コンパイル時間 206 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 86,528 KB
最終ジャッジ日時 2024-05-08 08:57:00
合計ジャッジ時間 3,065 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
86,528 KB
testcase_01 AC 53 ms
53,888 KB
testcase_02 AC 50 ms
53,376 KB
testcase_03 AC 49 ms
53,376 KB
testcase_04 AC 51 ms
53,696 KB
testcase_05 AC 46 ms
53,632 KB
testcase_06 AC 46 ms
53,632 KB
testcase_07 AC 47 ms
53,888 KB
testcase_08 AC 80 ms
76,288 KB
testcase_09 AC 83 ms
77,056 KB
testcase_10 AC 47 ms
53,504 KB
testcase_11 AC 98 ms
81,920 KB
testcase_12 AC 98 ms
81,276 KB
testcase_13 AC 99 ms
80,904 KB
testcase_14 AC 99 ms
80,768 KB
testcase_15 AC 97 ms
80,768 KB
testcase_16 AC 95 ms
80,768 KB
testcase_17 AC 99 ms
81,004 KB
testcase_18 AC 100 ms
80,896 KB
testcase_19 AC 99 ms
81,048 KB
testcase_20 AC 96 ms
80,768 KB
testcase_21 AC 96 ms
80,896 KB
testcase_22 AC 105 ms
86,528 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