結果
問題 | No.755 Zero-Sum Rectangle |
ユーザー | lllllll88938494 |
提出日時 | 2022-09-25 20:09:18 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 868 bytes |
コンパイル時間 | 294 ms |
コンパイル使用メモリ | 87,276 KB |
実行使用メモリ | 78,072 KB |
最終ジャッジ日時 | 2023-08-24 01:49:45 |
合計ジャッジ時間 | 16,148 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 69 ms
71,344 KB |
testcase_01 | TLE | - |
testcase_02 | AC | 1,337 ms
77,516 KB |
testcase_03 | AC | 1,312 ms
77,568 KB |
testcase_04 | AC | 1,281 ms
77,384 KB |
testcase_05 | AC | 1,246 ms
77,844 KB |
testcase_06 | AC | 1,241 ms
77,516 KB |
testcase_07 | AC | 1,229 ms
77,560 KB |
testcase_08 | AC | 1,233 ms
77,512 KB |
testcase_09 | AC | 1,246 ms
76,680 KB |
testcase_10 | AC | 1,235 ms
76,504 KB |
testcase_11 | AC | 76 ms
76,380 KB |
evil_1 | AC | 1,372 ms
78,176 KB |
ソースコード
from itertools import accumulate n,m=map(int,input().split()) a=[[0]*(m+2)] + [[0]+[i for i in accumulate(map(int,input().split()))]+[0] for i in range(m)] + [[0]*(m+2)] cnt=[[0]*(m+2) for i in range(m+2)] for i in range(1,m+2): for j in range(1,m+2): a[i][j] += a[i-1][j] for i in range(1,m+1): for j in range(1,m+1): for k in range(i,m+1): for l in range(j,m+1): if a[k][l] - a[i-1][l] - a[k][j-1] + a[i-1][j-1] == 0: cnt[i][j] += 1 cnt[i][l+1] -= 1 cnt[k+1][j] -= 1 cnt[k+1][l+1] += 1 for i in range(1,m+1): for j in range(1,m): cnt[i][j+1] += cnt[i][j] for j in range(1,m+1): for i in range(1,m): cnt[i+1][j] += cnt[i][j] for i in range(n): x,y=map(int,input().split()) print(cnt[x][y])