結果
問題 |
No.1490 スライムと爆弾
|
ユーザー |
![]() |
提出日時 | 2021-04-23 23:14:34 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,419 bytes |
コンパイル時間 | 165 ms |
コンパイル使用メモリ | 81,972 KB |
実行使用メモリ | 121,876 KB |
最終ジャッジ日時 | 2024-07-04 08:43:25 |
合計ジャッジ時間 | 7,204 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 WA * 15 |
ソースコード
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)