結果
問題 | No.844 split game |
ユーザー | 👑 obakyan |
提出日時 | 2019-06-30 00:26:02 |
言語 | Lua (LuaJit 2.1.1696795921) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,039 bytes |
コンパイル時間 | 223 ms |
コンパイル使用メモリ | 5,324 KB |
実行使用メモリ | 20,936 KB |
最終ジャッジ日時 | 2023-09-14 23:24:32 |
合計ジャッジ時間 | 8,352 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 117 ms
10,280 KB |
testcase_01 | AC | 77 ms
9,156 KB |
testcase_02 | AC | 301 ms
18,984 KB |
testcase_03 | AC | 180 ms
14,688 KB |
testcase_04 | AC | 83 ms
8,960 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 323 ms
20,868 KB |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 319 ms
20,864 KB |
testcase_19 | AC | 316 ms
20,708 KB |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | AC | 5 ms
4,380 KB |
testcase_27 | WA | - |
testcase_28 | AC | 4 ms
4,376 KB |
testcase_29 | AC | 15 ms
4,376 KB |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | AC | 4 ms
4,380 KB |
testcase_33 | AC | 26 ms
4,376 KB |
testcase_34 | AC | 15 ms
4,376 KB |
testcase_35 | AC | 31 ms
4,568 KB |
testcase_36 | AC | 18 ms
4,376 KB |
testcase_37 | AC | 48 ms
5,840 KB |
testcase_38 | AC | 106 ms
9,420 KB |
testcase_39 | AC | 247 ms
16,976 KB |
testcase_40 | AC | 52 ms
6,928 KB |
testcase_41 | AC | 1 ms
4,376 KB |
testcase_42 | AC | 1 ms
4,376 KB |
testcase_43 | AC | 1 ms
4,380 KB |
testcase_44 | AC | 1 ms
4,380 KB |
testcase_45 | AC | 1 ms
4,376 KB |
testcase_46 | AC | 1 ms
4,376 KB |
testcase_47 | AC | 1 ms
4,376 KB |
testcase_48 | WA | - |
testcase_49 | AC | 1 ms
4,376 KB |
testcase_50 | AC | 1 ms
4,376 KB |
testcase_51 | AC | 1 ms
4,380 KB |
testcase_52 | AC | 1 ms
4,376 KB |
testcase_53 | AC | 1 ms
4,376 KB |
testcase_54 | AC | 1 ms
4,380 KB |
testcase_55 | AC | 1 ms
4,376 KB |
testcase_56 | AC | 1 ms
4,376 KB |
testcase_57 | AC | 1 ms
4,380 KB |
testcase_58 | AC | 1 ms
4,376 KB |
testcase_59 | AC | 1 ms
4,380 KB |
ソースコード
local n, m, a = io.read("*n", "*n", "*n") local t = {} for i = 1, m do t[i] = {} t[i].l, t[i].r, t[i].p = io.read("*n", "*n", "*n") end table.sort(t, function(x, y) if x.r ~= y.r then return x.r < y.r else return x.l < y.l end end) local mma = math.max local ret = {} local inf = -100000000000000 for i = 1, n do ret[i] = inf end local curmax = {} local curpos = 1 for i = 1, n do curmax[i] = 0 end for i = 1, m do local l, r, p = t[i].l, t[i].r, t[i].p local cost = r == n and 0 or a if l == 1 then ret[r] = mma(ret[r], p - cost) else -- print(i, l, r, p, ret[l - 1]) if ret[l - 1] == inf then -- ret[r] = mma(ret[r], -a + p - cost) ret[l - 1] = curmax[l - 1] - a end ret[r] = mma(ret[r], ret[l - 1] + p - cost) end if curpos ~= r then for k = curpos + 1, r do curmax[k] = mma(curmax[k], curmax[k - 1]) end curpos = r end curmax[r] = mma(curmax[r], ret[r]) end local tot = 0 for i = 1, n do -- print(i, ret[i]) tot = mma(tot, ret[i]) end print(tot)