結果

問題 No.179 塗り分け
ユーザー _matumo__matumo_
提出日時 2018-07-16 11:43:14
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 2,414 bytes
コンパイル時間 1,635 ms
コンパイル使用メモリ 107,904 KB
実行使用メモリ 23,424 KB
最終ジャッジ日時 2024-04-28 06:30:24
合計ジャッジ時間 7,580 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
19,328 KB
testcase_01 AC 29 ms
19,072 KB
testcase_02 WA -
testcase_03 AC 29 ms
19,200 KB
testcase_04 WA -
testcase_05 AC 47 ms
23,168 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 184 ms
23,168 KB
testcase_09 AC 185 ms
22,912 KB
testcase_10 AC 31 ms
19,328 KB
testcase_11 AC 31 ms
19,328 KB
testcase_12 AC 178 ms
23,168 KB
testcase_13 AC 30 ms
19,328 KB
testcase_14 AC 29 ms
19,072 KB
testcase_15 AC 27 ms
18,688 KB
testcase_16 AC 29 ms
19,200 KB
testcase_17 AC 27 ms
18,816 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 177 ms
23,040 KB
testcase_21 AC 185 ms
23,040 KB
testcase_22 AC 191 ms
23,040 KB
testcase_23 AC 81 ms
23,296 KB
testcase_24 AC 181 ms
23,168 KB
testcase_25 AC 31 ms
19,456 KB
testcase_26 WA -
testcase_27 AC 182 ms
23,040 KB
testcase_28 WA -
testcase_29 AC 176 ms
23,040 KB
testcase_30 WA -
testcase_31 AC 180 ms
23,296 KB
testcase_32 WA -
testcase_33 AC 179 ms
22,912 KB
testcase_34 WA -
testcase_35 AC 181 ms
23,296 KB
testcase_36 AC 29 ms
18,944 KB
testcase_37 AC 29 ms
19,072 KB
testcase_38 AC 28 ms
18,816 KB
testcase_39 AC 29 ms
18,944 KB
testcase_40 AC 30 ms
18,944 KB
testcase_41 AC 29 ms
19,200 KB
testcase_42 AC 30 ms
18,944 KB
testcase_43 AC 35 ms
20,736 KB
testcase_44 AC 50 ms
23,040 KB
testcase_45 AC 29 ms
19,200 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)
        {
            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] != '#' && va[y + dY][x + dX] != '#')   continue;
                    if (va[y][x] == '#' && va[y + dY][x + dX] == '#')
                    {
                        va[y][x] = '.';
                        va[y + dY][x + dX] = '.';                       continue;
                    }
                    return false;
                }
            }
            for (int y = 0; y < yMax; y++)
            {
                for (int x = 0; x < xMax; x++)
                {
                    if (va[y][x] == '#') return false;
                }
            }
            return true;
        }
        //------------------------------------------------------------------//
        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