結果

問題 No.239 にゃんぱすー
ユーザー nokonokonokonoko
提出日時 2015-07-10 22:41:21
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 3,445 bytes
コンパイル時間 3,767 ms
コンパイル使用メモリ 107,808 KB
実行使用メモリ 23,816 KB
最終ジャッジ日時 2023-09-22 10:01:36
合計ジャッジ時間 7,344 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
19,772 KB
testcase_01 AC 61 ms
21,788 KB
testcase_02 AC 62 ms
21,824 KB
testcase_03 AC 61 ms
21,580 KB
testcase_04 AC 62 ms
23,688 KB
testcase_05 AC 62 ms
19,704 KB
testcase_06 AC 61 ms
23,780 KB
testcase_07 AC 62 ms
21,888 KB
testcase_08 AC 62 ms
21,836 KB
testcase_09 AC 68 ms
21,712 KB
testcase_10 AC 64 ms
21,788 KB
testcase_11 AC 63 ms
21,776 KB
testcase_12 AC 63 ms
23,648 KB
testcase_13 AC 63 ms
21,700 KB
testcase_14 AC 67 ms
21,688 KB
testcase_15 AC 64 ms
21,780 KB
testcase_16 AC 64 ms
23,816 KB
testcase_17 AC 63 ms
23,648 KB
testcase_18 AC 63 ms
19,836 KB
testcase_19 AC 64 ms
21,664 KB
testcase_20 AC 65 ms
23,756 KB
testcase_21 AC 63 ms
19,632 KB
testcase_22 AC 64 ms
23,676 KB
testcase_23 AC 66 ms
21,792 KB
testcase_24 AC 66 ms
21,780 KB
testcase_25 AC 65 ms
21,840 KB
testcase_26 AC 69 ms
21,780 KB
testcase_27 AC 63 ms
23,680 KB
testcase_28 AC 63 ms
23,624 KB
testcase_29 AC 65 ms
21,668 KB
testcase_30 AC 65 ms
21,652 KB
testcase_31 AC 66 ms
21,736 KB
testcase_32 AC 68 ms
21,744 KB
testcase_33 AC 62 ms
19,704 KB
testcase_34 AC 64 ms
23,704 KB
testcase_35 AC 64 ms
19,624 KB
testcase_36 AC 65 ms
21,836 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;

namespace YukiCoderNo239
{
    class Program
    {
        static void Main()
        {
            int length = LIB.IO.R<int>();
            int output = -1;
            string[][] greeding = LIB.IO.R<string>(length, ' ');
            int okcount = 0;

            for (int i = 0; i < length; i++)
            {
                bool flag = true;
                for (int j = 0; j < length; j++)
                {
                    if (!((greeding[i][j] == "nyanpass") || (i == j)))
                    {
                        flag = false;
                        break;
                    }
                }
                if (flag == true)
                {
                    output = i + 1;
                    if (okcount >= 1)
                    {
                        LIB.IO.W(-1);
                        LIB.IO.WFLUSH();
                        return;
                    }
                    okcount++;
                }
            }
            for (int i = 0; i < length; i++)
            {
                bool flag = true;
                for (int j = 0; j < length; j++)
                {
                    if (!((greeding[j][i] == "nyanpass") || (i == j)))
                    {
                        flag = false;
                        break;
                    }
                }
                if (flag == true)
                {
                    if (okcount >= 1)
                    {
                        if (output != i + 1)
                        {
                            LIB.IO.W(-1);
                            LIB.IO.WFLUSH();
                            return;
                        }
                    }
                    output = i + 1;
                    okcount++;
                }
            }
            LIB.IO.W(output);
            LIB.IO.WFLUSH();
        }
    }
}
namespace LIB
{
    public class IO
    {
        private const int WMAX = 1000;
        private static string WSTRING = "";
        public static T R<T>()
        {
            return (T)(Convert.ChangeType(R(), typeof(T)));
        }
        public static T[] R<T>(char splitter = ' ')
        {
            return R().Split(splitter).Select(v => UTILITY.PARSE<T>(v)).ToArray();
        }
        public static T[] R<T>(int length)
        {

            T[] ret = new T[length];
            for (int i = 0; i < length; i++)
            {
                ret[i] = R<T>();
            }
            return ret;
        }
        public static T[][] R<T>(int length, char splitter = ' ')
        {
            T[][] ret = new T[length][];
            for (int i = 0; i < length; i++)
            {
                ret[i] = R<T>(splitter);
            }
            return ret;
        }
        private static string R()
        {
            return Console.ReadLine();
        }
        public static void W(object value, bool addLineFeed = true)
        {
            WSTRING += UTILITY.PARSE<string>(value);
            if (addLineFeed == true) { WSTRING += "\n"; }
            if (WSTRING.Count() >= WMAX) { WFLUSH(); }
        }
        public static void WFLUSH()
        {
            Console.Write(WSTRING);
            WSTRING = "";
        }
    }
    public class UTILITY
    {
        public static T PARSE<T>(object value)
        {
            return (T)(Convert.ChangeType(value, typeof(T)));
        }
    }
}
0