結果
問題 | No.239 にゃんぱすー |
ユーザー |
|
提出日時 | 2020-03-06 22:39:21 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 44 ms / 2,000 ms |
コード長 | 1,129 bytes |
コンパイル時間 | 1,997 ms |
コンパイル使用メモリ | 113,012 KB |
実行使用メモリ | 22,528 KB |
最終ジャッジ日時 | 2024-10-14 09:02:14 |
合計ジャッジ時間 | 3,853 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;using System.Linq;using System.Collections.Generic;namespace _0239{class Program{static void Main(string[] args){var n = int.Parse(Console.ReadLine());var a = new List<string[]>();foreach(var i in Enumerable.Range(0,n)){var s = Console.ReadLine().Split().ToArray();a.Add(s);}var b = new List<HashSet<string>>();foreach(var i in Enumerable.Range(0,n)){var s = Enumerable.Range(0,n).Where(j => !a[j][i].Equals("-")).Select(j => a[j][i]).ToArray().ToHashSet();//Console.WriteLine(string.Join("",s));b.Add(s);}var ans = new List<int>();foreach(var i in Enumerable.Range(0,n)){if(b[i].Count == 1 && b[i].First().Equals("nyanpass")){ans.Add(i + 1);}}if(ans.Count == 1){Console.WriteLine(ans[0]);}else{Console.WriteLine(-1);}}}}