結果
問題 | No.1490 スライムと爆弾 |
ユーザー | netyo715 |
提出日時 | 2021-01-09 15:24:15 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 362 ms / 2,000 ms |
コード長 | 1,316 bytes |
コンパイル時間 | 297 ms |
コンパイル使用メモリ | 82,248 KB |
実行使用メモリ | 122,116 KB |
最終ジャッジ日時 | 2024-11-17 19:34:40 |
合計ジャッジ時間 | 6,214 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 38 ms
53,324 KB |
testcase_01 | AC | 35 ms
53,560 KB |
testcase_02 | AC | 48 ms
61,424 KB |
testcase_03 | AC | 46 ms
63,276 KB |
testcase_04 | AC | 45 ms
61,788 KB |
testcase_05 | AC | 43 ms
62,728 KB |
testcase_06 | AC | 42 ms
62,408 KB |
testcase_07 | AC | 44 ms
61,424 KB |
testcase_08 | AC | 42 ms
60,820 KB |
testcase_09 | AC | 44 ms
61,764 KB |
testcase_10 | AC | 38 ms
53,600 KB |
testcase_11 | AC | 39 ms
59,780 KB |
testcase_12 | AC | 42 ms
61,320 KB |
testcase_13 | AC | 229 ms
96,340 KB |
testcase_14 | AC | 235 ms
107,000 KB |
testcase_15 | AC | 204 ms
95,484 KB |
testcase_16 | AC | 206 ms
94,120 KB |
testcase_17 | AC | 167 ms
98,420 KB |
testcase_18 | AC | 269 ms
107,256 KB |
testcase_19 | AC | 244 ms
102,932 KB |
testcase_20 | AC | 242 ms
95,520 KB |
testcase_21 | AC | 192 ms
93,344 KB |
testcase_22 | AC | 226 ms
97,996 KB |
testcase_23 | AC | 39 ms
53,616 KB |
testcase_24 | AC | 33 ms
53,884 KB |
testcase_25 | AC | 268 ms
121,840 KB |
testcase_26 | AC | 279 ms
121,832 KB |
testcase_27 | AC | 283 ms
121,500 KB |
testcase_28 | AC | 272 ms
108,312 KB |
testcase_29 | AC | 264 ms
108,296 KB |
testcase_30 | AC | 362 ms
122,116 KB |
ソースコード
import sys input = sys.stdin.readline H, W, N, M = map(int, input().split()) SLIMES = [list(map(int, input().split())) for _ in range(N)] assert 1 <= H <= 2000 assert 1 <= W <= 2000 assert 1 <= N <= 10**5 assert 1 <= M <= 10**5 for t, u, l, r, a in SLIMES: assert 1 <= t <= H assert 1 <= u <= H assert t <= u assert 1 <= l <= W assert 1 <= r <= W assert l <= r assert 1 <= a <= 10**9 grid = [[0]*(W+1) for _ in range(H+1)] for _ in range(M): x, y, b, c = map(int, input().split()) assert 1 <= x <= H assert 1 <= y <= W assert 0 <= b < 2000 assert 1 <= c <= 10**6 x -= 1 y -= 1 grid[max(0, x-b)][max(0, y-b)] += c grid[min(H, x+b+1)][min(W, y+b+1)] += c grid[max(0, x-b)][min(W, y+b+1)] -= c grid[min(H, x+b+1)][max(0, y-b)] -= c for h in range(H+1): for w in range(1, W+1): grid[h][w] += grid[h][w-1] for h in range(1, H+1): for w in range(W+1): grid[h][w] += grid[h-1][w] for h in range(H): for w in range(1, W): grid[h][w] += grid[h][w-1] for h in range(1, H): for w in range(W): grid[h][w] += grid[h-1][w] ans = N for t, u, l, r, a in SLIMES: t -= 1 u -= 1 l -= 1 r -= 1 if grid[u][r] + grid[t-1][l-1] - grid[u][l-1] -grid[t-1][r] >= a: ans -= 1 print(ans)