結果

問題 No.938 賢人を探せ
ユーザー titiatitia
提出日時 2019-12-01 00:48:26
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 316 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 10,932 KB
実行使用メモリ 18,980 KB
最終ジャッジ日時 2023-08-21 03:27:01
合計ジャッジ時間 2,466 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
18,928 KB
testcase_01 AC 15 ms
7,796 KB
testcase_02 AC 15 ms
7,920 KB
testcase_03 AC 15 ms
7,828 KB
testcase_04 AC 15 ms
7,872 KB
testcase_05 AC 15 ms
7,948 KB
testcase_06 AC 16 ms
7,968 KB
testcase_07 AC 16 ms
7,772 KB
testcase_08 AC 65 ms
13,872 KB
testcase_09 AC 64 ms
14,136 KB
testcase_10 AC 16 ms
7,836 KB
testcase_11 AC 76 ms
16,868 KB
testcase_12 AC 62 ms
13,640 KB
testcase_13 AC 62 ms
13,656 KB
testcase_14 AC 63 ms
13,556 KB
testcase_15 AC 62 ms
13,536 KB
testcase_16 AC 63 ms
13,488 KB
testcase_17 AC 62 ms
13,684 KB
testcase_18 AC 63 ms
13,644 KB
testcase_19 AC 62 ms
13,628 KB
testcase_20 AC 63 ms
13,600 KB
testcase_21 AC 62 ms
13,684 KB
testcase_22 AC 92 ms
18,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())

M=[input().split() for i in range(N)]

ANS=[]
BAN=set()
USE=[0]*N

for x,y in M:
    ANS.append(y)
    BAN.add(x)

for i in range(N):
    if ANS[i] in BAN:
        USE[i]=1

A=[ANS[i] for i in range(N) if USE[i]==0]
USE=set()

for a in A:
    if a in USE:
        continue
    print(a)
    USE.add(a)
0