結果
| 問題 | No.755 Zero-Sum Rectangle |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-01-06 09:26:17 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 730 bytes |
| 記録 | |
| コンパイル時間 | 133 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 49,760 KB |
| 最終ジャッジ日時 | 2024-11-06 18:53:27 |
| 合計ジャッジ時間 | 7,514 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | TLE * 1 -- * 11 |
ソースコード
import itertools
import numpy as np
N, M = map(int, input().split())
A = np.zeros((M + 1, M + 1), dtype=np.int64)
A[1:, 1:] = np.array([tuple(map(int, input().split())) for _ in range(M)])
acc = A.cumsum(axis=0).cumsum(axis=1).tolist()
imos = [[0] * (M + 1) for _ in range(M + 1)]
for x1, x2 in itertools.combinations(range(M + 1), 2):
for y1, y2 in itertools.combinations(range(M + 1), 2):
if acc[x1][y1] + acc[x2][y2] == acc[x1][y2] + acc[x2][y1]:
imos[x1][y1] += 1
imos[x2][y2] += 1
imos[x1][y2] -= 1
imos[x2][y1] -= 1
imos = np.array(imos).cumsum(axis=0).cumsum(axis=1)
for _ in range(N):
x, y = ((int(a) - 1) for a in input().split())
print(imos[x, y])