結果
| 問題 | 
                            No.179 塗り分け
                             | 
                    
| コンテスト | |
| ユーザー | 
                             iicafiaxus
                         | 
                    
| 提出日時 | 2019-05-16 23:40:16 | 
| 言語 | D  (dmd 2.109.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,313 bytes | 
| コンパイル時間 | 834 ms | 
| コンパイル使用メモリ | 131,976 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-06-22 01:13:32 | 
| 合計ジャッジ時間 | 2,886 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 6 | 
| other | AC * 38 WA * 2 | 
ソースコード
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;
}
            
            
            
        
            
iicafiaxus