結果

問題 No.179 塗り分け
ユーザー mbanmban
提出日時 2016-11-09 17:21:43
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 2,123 bytes
コンパイル時間 841 ms
コンパイル使用メモリ 113,844 KB
実行使用メモリ 49,204 KB
最終ジャッジ日時 2024-04-14 06:12:19
合計ジャッジ時間 4,239 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
24,036 KB
testcase_01 AC 26 ms
21,944 KB
testcase_02 AC 26 ms
26,076 KB
testcase_03 AC 26 ms
25,948 KB
testcase_04 AC 25 ms
23,908 KB
testcase_05 AC 27 ms
26,040 KB
testcase_06 AC 26 ms
23,780 KB
testcase_07 WA -
testcase_08 AC 77 ms
47,356 KB
testcase_09 AC 27 ms
22,328 KB
testcase_10 AC 52 ms
47,224 KB
testcase_11 AC 50 ms
47,124 KB
testcase_12 AC 75 ms
49,204 KB
testcase_13 AC 26 ms
26,144 KB
testcase_14 AC 26 ms
23,916 KB
testcase_15 AC 26 ms
23,964 KB
testcase_16 AC 26 ms
24,036 KB
testcase_17 WA -
testcase_18 AC 51 ms
45,048 KB
testcase_19 AC 49 ms
48,032 KB
testcase_20 AC 75 ms
48,444 KB
testcase_21 AC 81 ms
45,440 KB
testcase_22 AC 95 ms
47,492 KB
testcase_23 AC 51 ms
45,180 KB
testcase_24 AC 77 ms
47,364 KB
testcase_25 AC 62 ms
47,284 KB
testcase_26 AC 41 ms
41,828 KB
testcase_27 AC 77 ms
47,624 KB
testcase_28 AC 40 ms
42,504 KB
testcase_29 AC 76 ms
47,236 KB
testcase_30 AC 46 ms
47,228 KB
testcase_31 AC 75 ms
45,320 KB
testcase_32 AC 61 ms
47,296 KB
testcase_33 AC 76 ms
45,696 KB
testcase_34 AC 50 ms
47,096 KB
testcase_35 AC 75 ms
45,448 KB
testcase_36 AC 25 ms
23,908 KB
testcase_37 AC 25 ms
24,092 KB
testcase_38 AC 26 ms
24,092 KB
testcase_39 AC 25 ms
26,208 KB
testcase_40 AC 26 ms
26,008 KB
testcase_41 AC 25 ms
24,036 KB
testcase_42 AC 25 ms
21,816 KB
testcase_43 AC 26 ms
24,096 KB
testcase_44 AC 27 ms
26,032 KB
testcase_45 AC 26 ms
26,004 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;

class Magatro
{
    static int H, W;
    static string[] S;
    static void Main()
    {
        Read();
        
       for(int x = -W; x <= W; x++)
        {
            for(int y = 0; y <= H; y++)
            {
                if (x == 0 && y == 0)
                {
                    continue;
                }
                if (s(x, y))
                {
                    Console.WriteLine("YES");
                    return;
                }
                
            }
        }
        Console.WriteLine("NO");
    }
    static bool s(int x,int y)
    {
        int[,] ban = new int[H, W];
        for(int i = 0; i < H; i++)
        {
            for(int j = 0; j < W; j++)
            {
                if (S[i][j] == '#')
                {
                    if (ban[i, j] == 0)
                    {
                        ban[i, j] = 1;
                        int bly = i + y;
                        int blx = j + x;
                      
                        if (blx < W && blx >= 0 && bly < H && bly >= 0)
                        {
                            if (S[bly][blx] != '#')
                            {
                                return false;
                            }
                            ban[bly, blx] = 2;
                        }
                        else
                        {
                            return false;
                        }
                    }
                }
            }
        }
        for (int i = 0; i < H; i++)
        {
            for (int j = 0; j < W; j++)
            {
                if (S[i][j] == '#' && ban[i, j] == 0)
                {
                    return false;
                }
               
            }
        }
                return true;
    }
    static void Read()
    {

        string[] s = Console.ReadLine().Split(' ');
        H = int.Parse(s[0]);
        W = int.Parse(s[1]);
        S = new string[H];
        for(int i = 0; i < H; i++)
        {
            S[i] = Console.ReadLine();
        }
    }
   
}
0