結果

問題 No.938 賢人を探せ
ユーザー GrayCoderGrayCoder
提出日時 2019-12-01 10:25:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 410 bytes
コンパイル時間 318 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 15,552 KB
最終ジャッジ日時 2024-05-08 08:56:56
合計ジャッジ時間 2,317 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
15,540 KB
testcase_01 AC 33 ms
10,880 KB
testcase_02 AC 32 ms
10,880 KB
testcase_03 AC 32 ms
10,624 KB
testcase_04 AC 32 ms
10,880 KB
testcase_05 AC 32 ms
10,624 KB
testcase_06 AC 32 ms
10,624 KB
testcase_07 AC 33 ms
10,752 KB
testcase_08 AC 53 ms
14,208 KB
testcase_09 AC 54 ms
14,336 KB
testcase_10 AC 33 ms
10,752 KB
testcase_11 AC 59 ms
14,816 KB
testcase_12 AC 55 ms
14,080 KB
testcase_13 AC 55 ms
13,952 KB
testcase_14 AC 57 ms
13,952 KB
testcase_15 AC 59 ms
13,952 KB
testcase_16 AC 58 ms
14,080 KB
testcase_17 AC 58 ms
13,952 KB
testcase_18 AC 58 ms
13,952 KB
testcase_19 AC 58 ms
13,952 KB
testcase_20 AC 59 ms
13,952 KB
testcase_21 AC 58 ms
14,080 KB
testcase_22 AC 79 ms
15,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N = int(input())
    AB = [tuple(input().split()) for _ in [0] * N]

    student = defaultdict(int)
    for a, b in AB:
        student[a] = -1
    ans = []
    for a, b in AB:
        if not student[b]:
            ans.append(b)
            student[b] = 1
    print(*ans, sep='\n')


main()
0