結果

問題 No.938 賢人を探せ
ユーザー titiatitia
提出日時 2019-12-01 00:48:26
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 117 ms / 2,000 ms
コード長 316 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 20,696 KB
最終ジャッジ日時 2024-05-08 08:54:30
合計ジャッジ時間 2,829 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
20,696 KB
testcase_01 AC 29 ms
10,752 KB
testcase_02 AC 28 ms
10,752 KB
testcase_03 AC 28 ms
10,752 KB
testcase_04 AC 28 ms
10,880 KB
testcase_05 AC 27 ms
10,752 KB
testcase_06 AC 26 ms
10,752 KB
testcase_07 AC 30 ms
10,880 KB
testcase_08 AC 79 ms
15,104 KB
testcase_09 AC 83 ms
15,232 KB
testcase_10 AC 29 ms
10,752 KB
testcase_11 AC 92 ms
18,004 KB
testcase_12 AC 81 ms
14,976 KB
testcase_13 AC 83 ms
14,976 KB
testcase_14 AC 81 ms
15,104 KB
testcase_15 AC 79 ms
14,976 KB
testcase_16 AC 81 ms
14,976 KB
testcase_17 AC 81 ms
14,976 KB
testcase_18 AC 80 ms
14,976 KB
testcase_19 AC 80 ms
14,976 KB
testcase_20 AC 80 ms
14,976 KB
testcase_21 AC 82 ms
14,976 KB
testcase_22 AC 115 ms
20,044 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