結果

問題 No.1490 スライムと爆弾
ユーザー mkawa2mkawa2
提出日時 2021-04-23 23:20:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 499 ms / 2,000 ms
コード長 1,427 bytes
コンパイル時間 336 ms
コンパイル使用メモリ 87,252 KB
実行使用メモリ 122,864 KB
最終ジャッジ日時 2023-09-17 13:09:06
合計ジャッジ時間 8,774 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,272 KB
testcase_01 AC 70 ms
71,104 KB
testcase_02 AC 80 ms
75,904 KB
testcase_03 AC 84 ms
75,660 KB
testcase_04 AC 82 ms
75,672 KB
testcase_05 AC 79 ms
75,768 KB
testcase_06 AC 80 ms
75,816 KB
testcase_07 AC 82 ms
75,772 KB
testcase_08 AC 81 ms
75,700 KB
testcase_09 AC 82 ms
75,832 KB
testcase_10 AC 75 ms
71,288 KB
testcase_11 AC 72 ms
70,884 KB
testcase_12 AC 80 ms
75,716 KB
testcase_13 AC 272 ms
97,204 KB
testcase_14 AC 309 ms
108,176 KB
testcase_15 AC 263 ms
96,276 KB
testcase_16 AC 250 ms
95,824 KB
testcase_17 AC 293 ms
99,340 KB
testcase_18 AC 360 ms
108,552 KB
testcase_19 AC 315 ms
103,572 KB
testcase_20 AC 290 ms
97,092 KB
testcase_21 AC 242 ms
93,904 KB
testcase_22 AC 278 ms
98,676 KB
testcase_23 AC 71 ms
71,220 KB
testcase_24 AC 77 ms
71,044 KB
testcase_25 AC 488 ms
122,576 KB
testcase_26 AC 499 ms
122,368 KB
testcase_27 AC 477 ms
122,384 KB
testcase_28 AC 392 ms
109,864 KB
testcase_29 AC 386 ms
109,532 KB
testcase_30 AC 467 ms
122,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.buffer.readline())
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.buffer.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def BI(): return sys.stdin.buffer.readline().rstrip()
def SI(): return sys.stdin.buffer.readline().rstrip().decode()
inf = 10 ** 16
md = 10 ** 9 + 7
# md = 998244353

h, w, n, m = LI()
ss = LLI(n)
cs = [[0] * (w + 2) for _ in range(h + 2)]
for _ in range(m):
    x, y, b, c = LI()
    i0 = max(1, x - b)
    i1 = min(h+1, x + b + 1)
    j0 = max(1, y - b)
    j1 = min(w+1, y + b + 1)
    cs[i0][j0] += c
    cs[i1][j1] += c
    cs[i0][j1] -= c
    cs[i1][j0] -= c
for i in range(1, h + 1):
    for j in range(w):
        cs[i][j + 1] += cs[i][j]
for j in range(1, w + 1):
    for i in range(h):
        cs[i + 1][j] += cs[i][j]
for i in range(1, h + 1):
    for j in range(w):
        cs[i][j + 1] += cs[i][j]
for j in range(1, w + 1):
    for i in range(h):
        cs[i + 1][j] += cs[i][j]
# p2D(cs)


ans = 0
for t, u, l, r, a in ss:
    t, l = t - 1, l - 1
    # print(cs[t][l] + cs[u][r] - cs[t][r] - cs[u][l])
    if cs[t][l] + cs[u][r] - cs[t][r] - cs[u][l] < a:
        ans += 1

print(ans)
0