結果
問題 | No.1490 スライムと爆弾 |
ユーザー | netyo715 |
提出日時 | 2021-01-05 20:32:34 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,334 bytes |
コンパイル時間 | 346 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 121,800 KB |
最終ジャッジ日時 | 2024-11-17 19:29:26 |
合計ジャッジ時間 | 5,497 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 34 ms
52,352 KB |
testcase_01 | AC | 33 ms
52,224 KB |
testcase_02 | AC | 42 ms
60,416 KB |
testcase_03 | AC | 44 ms
61,696 KB |
testcase_04 | AC | 41 ms
60,964 KB |
testcase_05 | AC | 45 ms
60,800 KB |
testcase_06 | AC | 41 ms
60,288 KB |
testcase_07 | AC | 43 ms
60,288 KB |
testcase_08 | AC | 41 ms
60,416 KB |
testcase_09 | AC | 40 ms
60,800 KB |
testcase_10 | AC | 34 ms
53,120 KB |
testcase_11 | AC | 38 ms
58,752 KB |
testcase_12 | AC | 42 ms
60,544 KB |
testcase_13 | AC | 218 ms
96,220 KB |
testcase_14 | AC | 215 ms
106,900 KB |
testcase_15 | AC | 194 ms
95,232 KB |
testcase_16 | AC | 192 ms
93,676 KB |
testcase_17 | AC | 162 ms
98,176 KB |
testcase_18 | AC | 249 ms
106,932 KB |
testcase_19 | AC | 231 ms
102,824 KB |
testcase_20 | AC | 218 ms
95,360 KB |
testcase_21 | AC | 176 ms
93,292 KB |
testcase_22 | AC | 209 ms
97,716 KB |
testcase_23 | AC | 34 ms
52,352 KB |
testcase_24 | AC | 35 ms
51,712 KB |
testcase_25 | AC | 269 ms
121,800 KB |
testcase_26 | AC | 268 ms
121,472 KB |
testcase_27 | AC | 259 ms
121,384 KB |
testcase_28 | AC | 267 ms
108,312 KB |
testcase_29 | AC | 262 ms
107,776 KB |
testcase_30 | RE | - |
ソースコード
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 assert N+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)