結果
問題 |
No.938 賢人を探せ
|
ユーザー |
![]() |
提出日時 | 2019-12-04 20:39:39 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 755 bytes |
コンパイル時間 | 953 ms |
コンパイル使用メモリ | 109,276 KB |
実行使用メモリ | 33,136 KB |
最終ジャッジ日時 | 2024-12-14 09:20:28 |
合計ジャッジ時間 | 3,930 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | AC * 4 WA * 17 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System.Collections.Generic; using System; public class Hello { static void Main() { var n = int.Parse(Console.ReadLine().Trim()); var c = new HashSet<string>(); var ok = new HashSet<string>(); var w = new string[2 * n]; var p = 0; for (int i = 0; i < n; i++) { string[] line = Console.ReadLine().Trim().Split(' '); var a = line[0]; var b = line[1]; w[p++] = a; w[p++] = b; c.Add(a); if (c.Add(b)) { ok.Add(b); c.Remove(b); } } for (int i = 0; i < 2 * n; i++) if (ok.Contains(w[i])) Console.WriteLine(w[i]); } }