結果
| 問題 |
No.239 にゃんぱすー
|
| ユーザー |
|
| 提出日時 | 2020-03-28 01:27:14 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 42 ms / 2,000 ms |
| コード長 | 792 bytes |
| コンパイル時間 | 1,088 ms |
| コンパイル使用メモリ | 116,092 KB |
| 実行使用メモリ | 28,256 KB |
| 最終ジャッジ日時 | 2025-01-02 10:23:01 |
| 合計ジャッジ時間 | 4,335 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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.Collections.Generic;
using System.Linq;
public class P0239 {
public static void Main() {
var n = int.Parse(Console.ReadLine().Trim());
var cands = Enumerable.Range(0, n).Select(i => true).ToList();
for(int i=0; i<n; i++){
var line = Console.ReadLine().Trim().Split(' ').ToList();
for(int j=0; j<n; j++) {
if(i != j) {
cands[j] &= line[j] == "nyanpass";
}
}
}
if(cands.Where(c => c).Count() == 1) {
Console.WriteLine(Enumerable.Range(1, n).Zip(cands, (i, j) => new { left = i, right = j }).Where(pair => pair.right).Select(pair => pair.left).First());
} else {
Console.WriteLine(-1);
}
}
}