結果
| 問題 | 
                            No.938 賢人を探せ
                             | 
                    
| コンテスト | |
| ユーザー | 
                             otsuri_114514
                         | 
                    
| 提出日時 | 2019-12-10 23:51:52 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 813 bytes | 
| コンパイル時間 | 339 ms | 
| コンパイル使用メモリ | 12,800 KB | 
| 実行使用メモリ | 31,288 KB | 
| 最終ジャッジ日時 | 2024-06-24 02:41:15 | 
| 合計ジャッジ時間 | 7,111 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | -- * 2 | 
| other | TLE * 1 -- * 20 | 
ソースコード
#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")
            
            
            
        
            
otsuri_114514