結果

問題 No.179 塗り分け
ユーザー 👑 horiesinitihoriesiniti
提出日時 2018-03-30 20:12:30
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 557 bytes
コンパイル時間 432 ms
コンパイル使用メモリ 11,228 KB
実行使用メモリ 15,664 KB
最終ジャッジ日時 2023-09-08 07:29:14
合計ジャッジ時間 36,492 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,188 KB
testcase_01 AC 80 ms
15,052 KB
testcase_02 AC 79 ms
15,048 KB
testcase_03 AC 78 ms
15,144 KB
testcase_04 AC 80 ms
15,164 KB
testcase_05 AC 252 ms
15,468 KB
testcase_06 AC 81 ms
15,068 KB
testcase_07 WA -
testcase_08 AC 1,878 ms
15,460 KB
testcase_09 WA -
testcase_10 AC 82 ms
15,056 KB
testcase_11 AC 81 ms
15,244 KB
testcase_12 AC 1,672 ms
15,216 KB
testcase_13 AC 86 ms
15,516 KB
testcase_14 AC 85 ms
15,412 KB
testcase_15 AC 79 ms
15,084 KB
testcase_16 AC 79 ms
15,212 KB
testcase_17 AC 79 ms
15,288 KB
testcase_18 AC 118 ms
15,480 KB
testcase_19 AC 117 ms
15,448 KB
testcase_20 AC 1,811 ms
15,348 KB
testcase_21 AC 1,948 ms
15,404 KB
testcase_22 AC 2,159 ms
15,388 KB
testcase_23 AC 83 ms
15,080 KB
testcase_24 AC 1,895 ms
15,300 KB
testcase_25 AC 97 ms
15,276 KB
testcase_26 WA -
testcase_27 AC 1,918 ms
15,196 KB
testcase_28 WA -
testcase_29 AC 1,931 ms
15,392 KB
testcase_30 WA -
testcase_31 AC 1,933 ms
15,448 KB
testcase_32 AC 574 ms
15,212 KB
testcase_33 AC 1,931 ms
15,400 KB
testcase_34 WA -
testcase_35 AC 1,927 ms
15,312 KB
testcase_36 AC 79 ms
15,072 KB
testcase_37 AC 79 ms
15,072 KB
testcase_38 AC 81 ms
15,092 KB
testcase_39 AC 79 ms
15,056 KB
testcase_40 AC 80 ms
15,128 KB
testcase_41 AC 80 ms
15,148 KB
testcase_42 AC 83 ms
15,272 KB
testcase_43 AC 113 ms
15,448 KB
testcase_44 AC 280 ms
15,512 KB
testcase_45 AC 90 ms
15,664 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def f(m,dx,dy,h,w)
	i=0
	arr=Array.new(h*2+3).map{Array.new(w*2+3,0)}
	c=0
	m.each{|e|
		j=0
		e.chars{|e2|
			if e2=="#"
				arr[i][j]=1
				c+=1
			else
				arr[i][j]=0
			end
			j+=1
		}
		i+=1
	}
	
	h.times{|y|
		w.times{|x|
			y1=y+dy
			x1=x+dx
			if arr[y][x]==1
				arr[y1][x1]-=1
				c-=2
			end
			return false if arr[y1][x1]<0
		}
	}
	return c==0
end

h,w=gets.split.map{|e| e.to_i}
m=[]
h.times{
	m<<gets.chomp
}



ok=false
h.times{|dy|
	w.times{|dx|
		if dy+dx!=0
			ok=ok||f(m,dx,dy,h,w)
		end
	}
}
if ok==true
	puts "YES"
else
	puts "NO"
end
0