結果

問題 No.607 開通777年記念
ユーザー NoNo
提出日時 2018-01-26 18:52:20
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 1,676 ms / 2,000 ms
コード長 1,303 bytes
コンパイル時間 3,618 ms
コンパイル使用メモリ 105,996 KB
実行使用メモリ 46,524 KB
最終ジャッジ日時 2023-08-27 18:41:37
合計ジャッジ時間 7,577 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
23,824 KB
testcase_01 AC 58 ms
21,652 KB
testcase_02 AC 57 ms
19,680 KB
testcase_03 AC 58 ms
21,840 KB
testcase_04 AC 58 ms
21,848 KB
testcase_05 AC 58 ms
21,724 KB
testcase_06 AC 58 ms
19,636 KB
testcase_07 AC 132 ms
23,816 KB
testcase_08 AC 57 ms
21,744 KB
testcase_09 AC 62 ms
19,580 KB
testcase_10 AC 59 ms
21,740 KB
testcase_11 AC 1,520 ms
46,524 KB
testcase_12 AC 1,676 ms
42,284 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.Linq;

namespace y
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] ss = Console.ReadLine().Split();
            int n = int.Parse(ss[0]);
            int m = int.Parse(ss[1]);
            int[] a = new int[n];
            bool f = false;

            for (int i = 0; i < m; i++)
            {
                int[] b = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
                for (int j = 0; j < n; j++)
                {
                    a[j] += b[j];
                }

                for (int j = 0; j < n; j++)
                {
                    if (a[j] == 777)
                    {
                        f = true;
                        break;
                    }
                    int r = 0;
                    for (int k = j; k < n; k++)
                    {
                        r += a[k];
                        if (r == 777)
                        {
                            f = true;
                            break;
                        }
                    }
                    if (f) break;
                }
                if (f) break;
            }
            if (f) Console.WriteLine("YES");
            else Console.WriteLine("NO");
        }
    }
}
0