結果

問題 No.179 塗り分け
ユーザー _matumo__matumo_
提出日時 2018-07-16 21:45:37
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 250 ms / 3,000 ms
コード長 2,361 bytes
コンパイル時間 2,861 ms
コンパイル使用メモリ 106,120 KB
実行使用メモリ 28,272 KB
最終ジャッジ日時 2023-09-30 21:02:22
合計ジャッジ時間 9,361 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
23,956 KB
testcase_01 AC 61 ms
23,856 KB
testcase_02 AC 60 ms
21,988 KB
testcase_03 AC 60 ms
21,892 KB
testcase_04 AC 60 ms
21,900 KB
testcase_05 AC 76 ms
27,960 KB
testcase_06 AC 61 ms
23,972 KB
testcase_07 AC 250 ms
28,056 KB
testcase_08 AC 205 ms
24,048 KB
testcase_09 AC 205 ms
28,068 KB
testcase_10 AC 61 ms
19,872 KB
testcase_11 AC 62 ms
23,808 KB
testcase_12 AC 200 ms
28,088 KB
testcase_13 AC 61 ms
21,944 KB
testcase_14 AC 61 ms
23,860 KB
testcase_15 AC 59 ms
22,012 KB
testcase_16 AC 61 ms
23,860 KB
testcase_17 AC 59 ms
23,824 KB
testcase_18 AC 67 ms
25,908 KB
testcase_19 AC 65 ms
21,800 KB
testcase_20 AC 197 ms
28,220 KB
testcase_21 AC 206 ms
23,976 KB
testcase_22 AC 215 ms
26,108 KB
testcase_23 AC 63 ms
23,972 KB
testcase_24 AC 202 ms
26,136 KB
testcase_25 AC 63 ms
21,936 KB
testcase_26 AC 83 ms
28,084 KB
testcase_27 AC 202 ms
27,980 KB
testcase_28 AC 69 ms
25,860 KB
testcase_29 AC 204 ms
28,212 KB
testcase_30 AC 123 ms
28,104 KB
testcase_31 AC 199 ms
26,112 KB
testcase_32 AC 101 ms
26,036 KB
testcase_33 AC 202 ms
28,272 KB
testcase_34 AC 91 ms
28,156 KB
testcase_35 AC 200 ms
26,116 KB
testcase_36 AC 62 ms
23,856 KB
testcase_37 AC 61 ms
23,856 KB
testcase_38 AC 61 ms
21,816 KB
testcase_39 AC 61 ms
23,956 KB
testcase_40 AC 62 ms
21,940 KB
testcase_41 AC 61 ms
21,828 KB
testcase_42 AC 60 ms
21,908 KB
testcase_43 AC 64 ms
21,940 KB
testcase_44 AC 80 ms
28,148 KB
testcase_45 AC 62 ms
21,820 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;
using System.Text;

namespace YukiCoder
{
    class Program
    {
        //------------------------------------------------------------------//
        static bool forXY(string S, int dY, int dX)
        {
            bool isSharp = false;

            var va = S.Split().Select(a => a.ToCharArray()).ToArray();
            for (int y = 0; y < yMax; y++)
            {
                if (y + dY >= yMax) break;
                for (int x = 0; x < xMax; x++)
                {
                    if (x + dX < 0 || x + dX >= xMax)                   continue;
                    if (va[y][x] != '#')                                continue;
                    if (va[y + dY][x + dX] != '#')                      return false;
                    va[y][x] = va[y + dY][x + dX] = '.';
                    isSharp = true;
                }
            }
            for (int y = 0; y < yMax; y++)
            {
                for (int x = 0; x < xMax; x++)
                {
                    if (va[y][x] == '#') return false;
                }
            }
            return isSharp;
        }
        //------------------------------------------------------------------//
        static bool forDxDy(string S)
        {
            for (int dy = 0; dy < yMax; dy++)
            {
                for (int dx = -xMax + 1; dx < xMax; dx++)
                {
                    if (dy == 0 && dx == 0) continue;
                    if (forXY(S, dy, dx)) return true;
                }
            }
            return false;
        }
        //------------------------------------------------------------------//
        static int yMax = 3;
        static int xMax = 3;
        static void Main(string[] args)
        {
            var va = Console.ReadLine().Trim().Split().Select(int.Parse).ToArray();
            yMax = va[0];
            xMax = va[1];
            string[] ps = new string[yMax];

            for (int i = 0; i < yMax; i++)
            {
                ps[i] = Console.ReadLine();
            }
            string S = string.Join(" ", ps);

            if (forDxDy(S)) Console.WriteLine("YES");
            else Console.WriteLine("NO");
            Console.ReadLine();
        }
        //------------------------------------------------------------------//
    }
}
0