結果

問題 No.755 Zero-Sum Rectangle
ユーザー cielciel
提出日時 2018-12-04 01:07:00
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 355 bytes
コンパイル時間 238 ms
コンパイル使用メモリ 11,516 KB
実行使用メモリ 15,140 KB
最終ジャッジ日時 2023-09-19 04:45:36
合計ジャッジ時間 5,232 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,140 KB
testcase_01 TLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
evil_1 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n,m=gets.split.map &:to_i
a=[[0]*-~m]
a+=m.times.map{[0]+gets.split.map(&:to_i)}
(m+1).times{|y|m.times{|x|a[y][x+1]+=a[y][x]}}
(m+1).times{|x|m.times{|y|a[y+1][x]+=a[y][x]}}
n.times{
	r=0
	x,y=gets.split.map{|e|e.to_i}
	(0...x).each{|x0|(x..m).each{|x1|
	(0...y).each{|y0|(y..m).each{|y1|
		r+=1 if a[x0][y0]-a[x1][y0]-a[x0][y1]+a[x1][y1]==0
	}}}}
	p r
}
0