結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
13,896 KB
testcase_01 AC 19 ms
8,556 KB
testcase_02 AC 18 ms
8,596 KB
testcase_03 AC 18 ms
8,480 KB
testcase_04 AC 18 ms
8,488 KB
testcase_05 AC 18 ms
8,620 KB
testcase_06 AC 19 ms
8,628 KB
testcase_07 AC 18 ms
8,476 KB
testcase_08 AC 38 ms
12,332 KB
testcase_09 AC 39 ms
12,580 KB
testcase_10 AC 19 ms
8,608 KB
testcase_11 AC 43 ms
12,992 KB
testcase_12 AC 38 ms
12,164 KB
testcase_13 AC 38 ms
12,296 KB
testcase_14 AC 38 ms
12,196 KB
testcase_15 AC 38 ms
12,312 KB
testcase_16 AC 38 ms
12,240 KB
testcase_17 AC 39 ms
12,156 KB
testcase_18 AC 38 ms
12,348 KB
testcase_19 AC 38 ms
12,168 KB
testcase_20 AC 39 ms
12,108 KB
testcase_21 AC 38 ms
12,312 KB
testcase_22 AC 53 ms
13,836 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