結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,300 KB
testcase_01 AC 74 ms
71,276 KB
testcase_02 AC 84 ms
75,684 KB
testcase_03 AC 82 ms
75,780 KB
testcase_04 WA -
testcase_05 AC 82 ms
75,628 KB
testcase_06 AC 84 ms
75,628 KB
testcase_07 AC 80 ms
75,776 KB
testcase_08 AC 83 ms
75,656 KB
testcase_09 WA -
testcase_10 AC 76 ms
71,112 KB
testcase_11 AC 73 ms
71,088 KB
testcase_12 AC 82 ms
75,856 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 73 ms
71,172 KB
testcase_25 AC 475 ms
122,464 KB
testcase_26 WA -
testcase_27 AC 479 ms
122,240 KB
testcase_28 AC 408 ms
109,876 KB
testcase_29 AC 397 ms
109,716 KB
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

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 + 1) for _ in range(h + 1)]
for _ in range(m):
    x, y, b, c = LI()
    i0 = max(1,x - b)
    i1 = min(h,x + b + 1)
    j0 = max(1,y - b)
    j1 = min(w,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