結果
| 問題 |
No.938 賢人を探せ
|
| コンテスト | |
| ユーザー |
neterukun
|
| 提出日時 | 2019-12-01 00:04:49 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 117 ms / 2,000 ms |
| コード長 | 509 bytes |
| コンパイル時間 | 607 ms |
| コンパイル使用メモリ | 82,400 KB |
| 実行使用メモリ | 91,140 KB |
| 最終ジャッジ日時 | 2024-12-14 11:38:28 |
| 合計ジャッジ時間 | 3,204 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 21 |
ソースコード
n = int(input())
info = [input().split() for i in range(n)]
to_int = {}
to_str = {}
cnt = 0
for i in range(n):
a, b = info[i]
if a not in to_int:
to_int[a] = cnt
to_str[cnt] = a
cnt += 1
if b not in to_int:
to_int[b] = cnt
to_str[cnt] = b
cnt += 1
graph = [[] for i in range(cnt)]
for i in range(n):
a, b = info[i]
a, b = to_int[a], to_int[b]
graph[a].append(b)
for i in range(cnt):
if len(graph[i]) == 0:
print(to_str[i])
neterukun