結果
問題 | No.755 Zero-Sum Rectangle |
ユーザー | lllllll88938494 |
提出日時 | 2022-09-25 19:43:25 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 973 bytes |
コンパイル時間 | 363 ms |
コンパイル使用メモリ | 87,180 KB |
実行使用メモリ | 77,904 KB |
最終ジャッジ日時 | 2023-08-24 01:48:14 |
合計ジャッジ時間 | 16,774 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 77 ms
71,248 KB |
testcase_01 | TLE | - |
testcase_02 | AC | 1,373 ms
77,536 KB |
testcase_03 | AC | 1,335 ms
77,728 KB |
testcase_04 | AC | 1,305 ms
77,520 KB |
testcase_05 | AC | 1,285 ms
77,488 KB |
testcase_06 | AC | 1,288 ms
77,904 KB |
testcase_07 | AC | 1,271 ms
77,624 KB |
testcase_08 | AC | 1,260 ms
77,552 KB |
testcase_09 | AC | 1,254 ms
76,640 KB |
testcase_10 | AC | 1,255 ms
77,428 KB |
testcase_11 | AC | 85 ms
75,932 KB |
evil_1 | AC | 1,404 ms
78,824 KB |
ソースコード
n,m=map(int,input().split()) a=[[0]*(m+1)] for i in range(m): a.append([0]+list(map(int,input().split()))) cnt=[[0]*(m+1) for i in range(m+1)] for i in range(1,len(a)): for j in range(1,len(a[i])): a[i][j] += a[i-1][j] + a[i][j-1] - a[i-1][j-1] 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 if l+1 <= m: cnt[i][l+1] -= 1 if k+1 <= m: cnt[k+1][j] -= 1 if k+1 <= m and l+1 <= m: 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])