結果

問題 No.179 塗り分け
ユーザー cedretabercedretaber
提出日時 2019-07-02 02:20:38
言語 D
(dmd 2.107.1)
結果
WA  
実行時間 -
コード長 1,011 bytes
コンパイル時間 717 ms
コンパイル使用メモリ 94,776 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-04 01:49:56
合計ジャッジ時間 2,391 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 WA -
testcase_02 AC 1 ms
4,380 KB
testcase_03 WA -
testcase_04 AC 1 ms
4,380 KB
testcase_05 WA -
testcase_06 AC 1 ms
4,380 KB
testcase_07 WA -
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 1 ms
4,376 KB
testcase_17 WA -
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 2 ms
4,376 KB
testcase_24 WA -
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 WA -
testcase_28 AC 1 ms
4,376 KB
testcase_29 WA -
testcase_30 AC 1 ms
4,380 KB
testcase_31 WA -
testcase_32 AC 1 ms
4,380 KB
testcase_33 WA -
testcase_34 AC 2 ms
4,380 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto hw = readln.split.to!(int[]);
    auto H = hw[0];
    auto W = hw[1];
    char[][] MAP;
    MAP.length = H;
    int b;
    foreach (i; 0..H) {
        MAP[i].length = W;
        foreach (j, e; readln.chomp.to!(char[])) {
            if (e == '#') ++b;
            MAP[i][j] = e;
        }
    }
    if (b%2 == 1) {
        writeln("N0");
        return;
    }

    auto MEMO = new int[][](H, W);

    int c;
    foreach (y; 0..H) {
        foreach (x; 0..W) {
            ++c;
            foreach (i; 0..H) {
                foreach (j; 0..W) {
                    if (MAP[i][j] != '#' || MEMO[i][j] == c) continue;
                    if (i+y >= H || j+x >= W || MAP[i+y][j+x] != '#') goto next;
                    MEMO[i][j] = MEMO[i+y][j+x] = c;
                }
            }
            writeln("YES");
            return;
            next:
        }
    }
    writeln("NO");
}
0