結果
| 問題 |
No.938 賢人を探せ
|
| コンテスト | |
| ユーザー |
mkawa2
|
| 提出日時 | 2019-12-01 11:27:46 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 122 ms / 2,000 ms |
| コード長 | 739 bytes |
| コンパイル時間 | 135 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 19,576 KB |
| 最終ジャッジ日時 | 2024-12-14 11:43:36 |
| 合計ジャッジ時間 | 2,550 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 21 |
ソースコード
import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def main():
ok = set()
ng = set()
name_to_i = {}
n = int(input())
for i in range(n):
ng_name, ok_name = input().split()
ok.add(ok_name)
ng.add(ng_name)
if ng_name not in name_to_i:
name_to_i[ng_name] = i * 2
if ok_name not in name_to_i:
name_to_i[ok_name] = i * 2 + 1
ok -= ng
for name in sorted(ok, key=lambda x: name_to_i[x]):
print(name)
main()
mkawa2