結果
問題 | No.1490 スライムと爆弾 |
ユーザー | 👑 obakyan |
提出日時 | 2021-04-30 21:12:53 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
AC
|
実行時間 | 350 ms / 2,000 ms |
コード長 | 1,489 bytes |
コンパイル時間 | 342 ms |
コンパイル使用メモリ | 7,072 KB |
実行使用メモリ | 43,648 KB |
最終ジャッジ日時 | 2024-07-18 21:53:52 |
合計ジャッジ時間 | 5,853 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,816 KB |
testcase_01 | AC | 1 ms
6,944 KB |
testcase_02 | AC | 2 ms
6,944 KB |
testcase_03 | AC | 2 ms
6,944 KB |
testcase_04 | AC | 2 ms
6,940 KB |
testcase_05 | AC | 2 ms
6,944 KB |
testcase_06 | AC | 2 ms
6,944 KB |
testcase_07 | AC | 2 ms
6,940 KB |
testcase_08 | AC | 2 ms
6,944 KB |
testcase_09 | AC | 2 ms
6,944 KB |
testcase_10 | AC | 2 ms
6,944 KB |
testcase_11 | AC | 2 ms
6,940 KB |
testcase_12 | AC | 2 ms
6,940 KB |
testcase_13 | AC | 142 ms
27,264 KB |
testcase_14 | AC | 162 ms
34,176 KB |
testcase_15 | AC | 121 ms
32,000 KB |
testcase_16 | AC | 112 ms
24,448 KB |
testcase_17 | AC | 104 ms
24,320 KB |
testcase_18 | AC | 171 ms
30,592 KB |
testcase_19 | AC | 180 ms
38,400 KB |
testcase_20 | AC | 143 ms
35,328 KB |
testcase_21 | AC | 108 ms
33,280 KB |
testcase_22 | AC | 135 ms
30,720 KB |
testcase_23 | AC | 1 ms
6,940 KB |
testcase_24 | AC | 2 ms
6,940 KB |
testcase_25 | AC | 263 ms
43,648 KB |
testcase_26 | AC | 269 ms
43,648 KB |
testcase_27 | AC | 262 ms
43,520 KB |
testcase_28 | AC | 259 ms
38,528 KB |
testcase_29 | AC | 254 ms
38,528 KB |
testcase_30 | AC | 350 ms
43,648 KB |
ソースコード
local mmi, mma = math.min, math.max local h, w = io.read("*n", "*n") local n, m = io.read("*n", "*n") local r1, r2, c1, c2, a = {}, {}, {}, {}, {} for i = 1, n do r1[i], r2[i], c1[i], c2[i], a[i] = io.read("*n", "*n", "*n", "*n", "*n") end local t = {} for i = 1, h do t[i] = {} for j = 1, w do t[i][j] = 0 end end for i = 1, m do local x, y, b, c = io.read("*n", "*n", "*n", "*n") local rowmin = mma(1, x - b) local rowmax = mmi(h, x + b) local colmin = mma(1, y - b) local colmax = mmi(w, y + b) t[rowmin][colmin] = t[rowmin][colmin] + c if rowmax < h then t[rowmax + 1][colmin] = t[rowmax + 1][colmin] - c end if colmax < w then t[rowmin][colmax + 1] = t[rowmin][colmax + 1] - c end if rowmax < h and colmax < w then t[rowmax + 1][colmax + 1] = t[rowmax + 1][colmax + 1] + c end end for i = 1, h do for j = 1, w - 1 do t[i][j + 1] = t[i][j + 1] + t[i][j] end end for j = 1, w do for i = 1, h - 1 do t[i + 1][j] = t[i + 1][j] + t[i][j] end end for i = 1, h do for j = 1, w - 1 do t[i][j + 1] = t[i][j + 1] + t[i][j] end end for j = 1, w do for i = 1, h - 1 do t[i + 1][j] = t[i + 1][j] + t[i][j] end end local ret = 0 for i = 1, n do local v = t[r2[i]][c2[i]] if 1 < r1[i] then v = v - t[r1[i] - 1][c2[i]] end if 1 < c1[i] then v = v - t[r2[i]][c1[i] - 1] end if 1 < r1[i] and 1 < c1[i] then v = v + t[r1[i] - 1][c1[i] - 1] end if v < a[i] then ret = ret + 1 end end print(ret)