結果

問題 No.733 分身並列コーディング
ユーザー 👑 obakyanobakyan
提出日時 2020-03-27 22:18:38
言語 Lua
(LuaJit 2.1.1696795921)
結果
WA  
実行時間 -
コード長 788 bytes
コンパイル時間 67 ms
コンパイル使用メモリ 5,296 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-08-30 16:55:53
合計ジャッジ時間 2,866 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 58 ms
4,380 KB
testcase_04 AC 58 ms
4,376 KB
testcase_05 AC 30 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 29 ms
4,380 KB
testcase_08 AC 29 ms
4,376 KB
testcase_09 WA -
testcase_10 AC 3 ms
4,376 KB
testcase_11 AC 3 ms
4,384 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 9 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 3 ms
4,376 KB
testcase_19 AC 16 ms
4,380 KB
testcase_20 WA -
testcase_21 AC 10 ms
4,376 KB
testcase_22 AC 35 ms
4,376 KB
testcase_23 AC 10 ms
4,376 KB
testcase_24 WA -
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 33 ms
4,376 KB
testcase_29 AC 35 ms
4,380 KB
testcase_30 AC 33 ms
4,376 KB
testcase_31 AC 35 ms
4,380 KB
testcase_32 AC 5 ms
4,380 KB
testcase_33 AC 5 ms
4,380 KB
testcase_34 WA -
testcase_35 AC 5 ms
4,380 KB
testcase_36 AC 5 ms
4,380 KB
testcase_37 AC 5 ms
4,380 KB
testcase_38 AC 32 ms
4,380 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 5 ms
4,376 KB
testcase_43 AC 5 ms
4,376 KB
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 32 ms
4,380 KB
testcase_47 WA -
testcase_48 AC 34 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local bls, brs = bit.lshift, bit.rshift
local limit = io.read("*n")
local n = io.read("*n")
local ret = 0
local t = {}
for i = 1, n do
  t[i] = io.read("*n")
end
while true do
  ret = ret + 1
  local tot = bls(1, n)
  local candpos, candval = -1, -1
  for it = 0, tot - 1 do
    local a = 0
    local tmp_it = it
    for i = 1, n do
      if tmp_it % 2 == 1 then
        a = a + t[i]
      end
      tmp_it = brs(tmp_it, 1)
    end
    if a <= limit then
      if candval < a then
        candpos, candval = it, a
      end
    end
  end
  local box = {}
  for i = 1, n do
    if candpos % 2 == 1 then
      box[i] = true
    end
    candpos = brs(candpos, 1)
  end
  for i = n, 1, -1 do
    if box[i] then table.remove(t, i) end
  end
  n = #t
  if #t == 0 then break end
end
print(ret)
0