結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 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 32 ms
4,380 KB
testcase_09 AC 32 ms
4,376 KB
testcase_10 AC 41 ms
4,376 KB
testcase_11 AC 36 ms
4,380 KB
testcase_12 AC 36 ms
4,384 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,376 KB
testcase_17 WA -
testcase_18 AC 39 ms
4,376 KB
testcase_19 AC 36 ms
4,380 KB
testcase_20 AC 36 ms
4,376 KB
testcase_21 AC 36 ms
4,376 KB
testcase_22 AC 33 ms
4,376 KB
testcase_23 AC 44 ms
4,380 KB
testcase_24 AC 35 ms
4,380 KB
testcase_25 AC 36 ms
4,376 KB
testcase_26 AC 53 ms
4,380 KB
testcase_27 AC 74 ms
4,376 KB
testcase_28 AC 98 ms
4,376 KB
testcase_29 AC 90 ms
4,380 KB
testcase_30 AC 86 ms
4,380 KB
testcase_31 AC 101 ms
4,376 KB
testcase_32 AC 77 ms
4,380 KB
testcase_33 AC 81 ms
4,380 KB
testcase_34 AC 96 ms
4,380 KB
testcase_35 AC 91 ms
4,376 KB
testcase_36 AC 1 ms
4,380 KB
testcase_37 AC 1 ms
4,376 KB
testcase_38 AC 2 ms
4,376 KB
testcase_39 AC 2 ms
4,376 KB
testcase_40 AC 1 ms
4,384 KB
testcase_41 AC 1 ms
4,380 KB
testcase_42 AC 1 ms
4,380 KB
testcase_43 AC 3 ms
4,380 KB
testcase_44 AC 12 ms
4,380 KB
testcase_45 AC 1 ms
4,380 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 .. w){ // h = w = 1 のときでもループが回るように -w からにしている
		bool flag = 1;
		if(a == 0 && b == 0) continue;
		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;
			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