結果
問題 |
No.938 賢人を探せ
|
ユーザー |
![]() |
提出日時 | 2019-12-04 20:49:57 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 799 bytes |
コンパイル時間 | 1,465 ms |
コンパイル使用メモリ | 110,364 KB |
実行使用メモリ | 35,824 KB |
最終ジャッジ日時 | 2024-12-14 09:31:05 |
合計ジャッジ時間 | 3,191 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 5 WA * 16 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System.Linq; 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 List<string>(); for (int i = 0; i < n; i++) { string[] line = Console.ReadLine().Trim().Split(' '); var a = line[0]; var b = line[1]; w.Add(a); w.Add(b); c.Add(a); if (c.Add(b)) { ok.Add(b); c.Remove(b); } } var w2 = w.Distinct().ToList(); for (int i = 0; i < w2.Count(); i++) if (ok.Contains(w2[i])) Console.WriteLine(w2[i]); } }