結果
| 問題 | 
                            No.179 塗り分け
                             | 
                    
| コンテスト | |
| ユーザー | 
                             _matumo_
                         | 
                    
| 提出日時 | 2018-07-16 21:45:37 | 
| 言語 | C#(csc)  (csc 3.9.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 227 ms / 3,000 ms | 
| コード長 | 2,361 bytes | 
| コンパイル時間 | 1,121 ms | 
| コンパイル使用メモリ | 113,140 KB | 
| 実行使用メモリ | 31,436 KB | 
| 最終ジャッジ日時 | 2024-07-23 14:50:04 | 
| 合計ジャッジ時間 | 5,992 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 6 | 
| other | AC * 40 | 
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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();
        }
        //------------------------------------------------------------------//
    }
}
            
            
            
        
            
_matumo_