結果

問題 No.938 賢人を探せ
ユーザー otsuri_114514otsuri_114514
提出日時 2019-12-10 23:52:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 693 ms / 2,000 ms
コード長 814 bytes
コンパイル時間 749 ms
コンパイル使用メモリ 82,036 KB
実行使用メモリ 79,676 KB
最終ジャッジ日時 2024-05-08 09:04:33
合計ジャッジ時間 5,819 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 693 ms
79,676 KB
testcase_01 AC 44 ms
51,584 KB
testcase_02 AC 46 ms
51,584 KB
testcase_03 AC 44 ms
51,712 KB
testcase_04 AC 45 ms
51,712 KB
testcase_05 AC 46 ms
52,096 KB
testcase_06 AC 46 ms
51,840 KB
testcase_07 AC 51 ms
51,712 KB
testcase_08 AC 74 ms
72,704 KB
testcase_09 AC 71 ms
72,960 KB
testcase_10 AC 39 ms
52,096 KB
testcase_11 AC 70 ms
74,880 KB
testcase_12 AC 182 ms
77,568 KB
testcase_13 AC 182 ms
78,544 KB
testcase_14 AC 185 ms
77,824 KB
testcase_15 AC 182 ms
78,068 KB
testcase_16 AC 182 ms
78,184 KB
testcase_17 AC 190 ms
77,568 KB
testcase_18 AC 187 ms
77,848 KB
testcase_19 AC 192 ms
78,092 KB
testcase_20 AC 185 ms
78,080 KB
testcase_21 AC 184 ms
77,824 KB
testcase_22 AC 671 ms
79,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#import pysnooper
#import numpy
#import os,re,sys,operator
#from collections import Counter,deque
#from operator import itemgetter,mul
#from itertools import accumulate#,combinations,groupby,combinations_with_replacement,permutations
from sys import stdin,setrecursionlimit
#from bisect import bisect_left,bisect_right
#from copy import deepcopy
#import heapq
#import math
#import string
#from time import time
#from functools import lru_cache,reduce
#from math import factorial
#import sys

setrecursionlimit(10**6)
input=stdin.readline

n=int(input().rstrip())
ans=set()
d=set()
r=[]
info=[]
for i in range(n):
    a,b=input().split()
    info.append(b)
    d.add(a)
    ans.add(b)
for i in ans:
    if i not in d: r.append(i)
print(*sorted(r,key=lambda x: info.index(x) if x in info else float('inf')),sep="\n")
0