結果

問題 No.179 塗り分け
ユーザー iicafiaxusiicafiaxus
提出日時 2019-05-16 23:43:08
言語 D
(dmd 2.105.2)
結果
WA  
実行時間 -
コード長 1,220 bytes
コンパイル時間 1,063 ms
コンパイル使用メモリ 118,076 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-04 01:06:48
合計ジャッジ時間 3,858 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

import std.stdio, std.conv, std.string;
import std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

int DEBUG_LEVEL = 0;
void print()(){ writeln(""); }
void print(T, A ...)(T t, lazy A a){ write(t), print(a); }
void print(int level, T, A ...)(T t, lazy A a){ if(level <= DEBUG_LEVEL) print(t, a); }

void main(string[] args){
	if(args.length > 1 && args[1] == "-debug"){
		if(args.length > 2 && args[2].isNumeric) DEBUG_LEVEL = args[2].to!int;
		else DEBUG_LEVEL = 1;
	}
	
	long h = read.to!long;
	long w = read.to!long;
	
	bool[][] xs;
	foreach(i; 0 .. h){
		xs ~= readln.chomp.map!(x => x == '#').array;
	}
	
	string ans = "NO";
	bool[][] ys = new bool[][](h, w);
	foreach(a; 0 .. h) foreach(b; -w + 1 .. w){
		bool flag = 1;
		foreach(i; 0 .. h) foreach(j; 0 .. w) ys[i][j] = xs[i][j];
		foreach(i; 0 .. h) foreach(j; 0 .. w){
			if(! ys[i][j]) continue;
			ys[i][j] = 0;
			if(i + a < h && j + b >= 0 && j + b < w && ys[i + a][j + b]) ys[i + a][j + b] = 0;
			else flag = 0;
		}
		if(flag) ans = "YES";
	}
	
	ans.writeln;
}
0