結果

問題 No.1689 Set Cards
ユーザー 👑 obakyanobakyan
提出日時 2022-01-10 10:50:03
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 740 bytes
コンパイル時間 116 ms
コンパイル使用メモリ 5,376 KB
実行使用メモリ 46,464 KB
最終ジャッジ日時 2024-04-26 20:01:16
合計ジャッジ時間 2,333 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 6 ms
5,376 KB
testcase_03 AC 5 ms
5,376 KB
testcase_04 AC 5 ms
5,376 KB
testcase_05 AC 4 ms
5,376 KB
testcase_06 AC 5 ms
5,376 KB
testcase_07 AC 3 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 4 ms
5,376 KB
testcase_11 AC 87 ms
46,464 KB
testcase_12 AC 88 ms
46,336 KB
testcase_13 AC 93 ms
46,336 KB
testcase_14 AC 88 ms
46,336 KB
testcase_15 AC 27 ms
13,824 KB
testcase_16 AC 68 ms
31,488 KB
testcase_17 AC 16 ms
9,856 KB
testcase_18 AC 87 ms
46,208 KB
testcase_19 AC 80 ms
46,336 KB
testcase_20 AC 79 ms
46,080 KB
testcase_21 AC 119 ms
46,080 KB
testcase_22 AC 108 ms
46,208 KB
testcase_23 AC 109 ms
46,208 KB
testcase_24 AC 81 ms
46,208 KB
testcase_25 AC 83 ms
46,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local band = bit.band
local bls, brs = bit.lshift, bit.rshift
local mod = 998244353
local function badd(x, y) return (x + y) % mod end
local n = io.read("*n")
local lim = 8192
local pre, suf = {}, {}
local vs = {}
for i = 1, n do
  local v = 0
  local k = io.read("*n")
  for j = 1, k do
    local c = io.read("*n")
    v = v + bls(1, c)
  end
  vs[i] = v
end
for i = 1, n do
  pre[i] = {}
  local v = vs[i]
  if i == 1 then
    for j = 1, lim do pre[i][j] = 0 end
    pre[i][v + 1] = 1
  else
    for j = 1, lim do pre[i][j] = pre[i - 1][j] end
    for j = 1, lim do
      local dst = band(j - 1, v)
      pre[i][dst + 1] = badd(pre[i][dst + 1], pre[i - 1][j])
    end
    pre[i][v + 1] = badd(pre[i][v + 1], 1)
  end
end
print(pre[n][1])
0