結果

問題 No.755 Zero-Sum Rectangle
ユーザー cielciel
提出日時 2018-12-04 01:24:36
言語 Crystal
(1.11.2)
結果
RE  
実行時間 -
コード長 389 bytes
コンパイル時間 17,249 ms
コンパイル使用メモリ 255,808 KB
実行使用メモリ 5,316 KB
最終ジャッジ日時 2023-09-13 09:51:21
合計ジャッジ時間 26,467 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,392 KB
testcase_01 AC 559 ms
4,940 KB
testcase_02 AC 417 ms
4,844 KB
testcase_03 AC 583 ms
4,936 KB
testcase_04 AC 655 ms
4,936 KB
testcase_05 AC 689 ms
4,956 KB
testcase_06 AC 442 ms
5,012 KB
testcase_07 AC 429 ms
5,108 KB
testcase_08 AC 574 ms
5,120 KB
testcase_09 AC 640 ms
5,116 KB
testcase_10 RE -
testcase_11 RE -
evil_1 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=gets.not_nil!.split.map &.to_i
a=[[0]*-~m]
a+=m.times.map{[0]+gets.not_nil!.split.map(&.to_i).to_a}.to_a
(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.not_nil!.split.map(&.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