結果
問題 |
No.755 Zero-Sum Rectangle
|
ユーザー |
![]() |
提出日時 | 2021-11-17 22:04:04 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 225 ms / 2,000 ms |
コード長 | 890 bytes |
コンパイル時間 | 2,397 ms |
コンパイル使用メモリ | 211,980 KB |
実行使用メモリ | 13,756 KB |
最終ジャッジ日時 | 2024-06-22 13:18:12 |
合計ジャッジ時間 | 7,374 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 11 TLE * 1 |
ソースコード
import std; void main() { int N, M; readf("%d %d\n", N, M); auto A = new long[][](M+1, M+1); foreach (i; 0 .. M) { auto input = readln.chomp.split.to!(long[]); A[i+1][1..M+1] = input; } foreach (i; 0 .. M) { A[i+1][] += A[i][]; } foreach (i; 1 .. M+1) { foreach (j; 0 .. M) { A[i][j+1] += A[i][j]; } } foreach (i; 0 .. N) { int x, y; readf("%d %d\n", x, y); long res; foreach (xs; 1 .. x+1) { foreach (xt; x .. M+1) { foreach (ys; 1 .. y+1) { foreach (yt; y .. M+1) { if (A[xt][yt] - A[xs-1][yt] - A[xt][ys-1] + A[xs-1][ys-1] == 0) { ++res; } } } } } res.writeln; } }