結果
問題 | No.1490 スライムと爆弾 |
ユーザー | netyo715 |
提出日時 | 2021-01-09 15:20:03 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,314 bytes |
コンパイル時間 | 190 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 121,600 KB |
最終ジャッジ日時 | 2024-11-17 19:33:44 |
合計ジャッジ時間 | 6,338 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 40 ms
52,224 KB |
testcase_01 | AC | 41 ms
52,352 KB |
testcase_02 | AC | 50 ms
60,544 KB |
testcase_03 | AC | 52 ms
61,696 KB |
testcase_04 | AC | 51 ms
60,928 KB |
testcase_05 | AC | 50 ms
60,288 KB |
testcase_06 | AC | 49 ms
60,544 KB |
testcase_07 | AC | 51 ms
60,928 KB |
testcase_08 | AC | 50 ms
60,800 KB |
testcase_09 | AC | 51 ms
60,800 KB |
testcase_10 | AC | 42 ms
53,632 KB |
testcase_11 | AC | 46 ms
58,624 KB |
testcase_12 | AC | 50 ms
60,160 KB |
testcase_13 | AC | 245 ms
96,204 KB |
testcase_14 | AC | 262 ms
106,952 KB |
testcase_15 | AC | 223 ms
95,560 KB |
testcase_16 | AC | 228 ms
93,824 KB |
testcase_17 | AC | 192 ms
98,176 KB |
testcase_18 | AC | 289 ms
107,136 KB |
testcase_19 | AC | 266 ms
103,040 KB |
testcase_20 | AC | 260 ms
95,640 KB |
testcase_21 | AC | 206 ms
93,184 KB |
testcase_22 | AC | 241 ms
97,920 KB |
testcase_23 | AC | 40 ms
52,224 KB |
testcase_24 | AC | 40 ms
52,224 KB |
testcase_25 | AC | 321 ms
121,600 KB |
testcase_26 | AC | 324 ms
121,600 KB |
testcase_27 | AC | 304 ms
121,472 KB |
testcase_28 | AC | 296 ms
108,336 KB |
testcase_29 | AC | 278 ms
108,160 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 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)