結果

問題 No.755 Zero-Sum Rectangle
コンテスト
ユーザー Shuz*
提出日時 2018-11-15 19:35:08
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
TLE  
実行時間 -
コード長 603 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 508 ms
コンパイル使用メモリ 20,696 KB
実行使用メモリ 31,176 KB
最終ジャッジ日時 2026-03-13 23:30:59
合計ジャッジ時間 35,229 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 1 TLE * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n, m = map(int, input().split())
a = [[0 for i in range(m + 1)]]
for i in range(m):
    a.append(list(map(int, input().split())))
    a[i + 1].insert(0, 0)
for i in range(m):
    for j in range(m):
        a[i + 1][j + 1] += a[i][j + 1] + a[i + 1][j] - a[i][j]
for i in range(n):
    x, y = map(int, input().split())
    res = 0
    for x1 in range(x):
        for y1 in range(y):
            for x2 in range(m - x + 1):
                for y2 in range(m - y + 1):
                    if a[x1][y1] + a[x2 + x][y2 + y] - a[x1][y2 + y] - a[x2 + x][y1] == 0:
                        res += 1
    print(res)
0