結果
問題 | No.1535 五七五 |
ユーザー |
👑 |
提出日時 | 2021-06-19 19:25:15 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
AC
|
実行時間 | 354 ms / 2,000 ms |
コード長 | 737 bytes |
コンパイル時間 | 169 ms |
コンパイル使用メモリ | 5,248 KB |
実行使用メモリ | 32,528 KB |
最終ジャッジ日時 | 2024-06-22 22:18:11 |
合計ジャッジ時間 | 4,542 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
local n = io.read("*n")local a, b, c = io.read("*n", "*n", "*n", "*l")local s = io.read()local t = {}for w in s:gmatch("%w+") dotable.insert(t, #w)endfor i = 2, n dot[i] = t[i - 1] + t[i]endlocal ret = 0local offset = 0local ap, bp, cp = 1, 1, 1for i = 1, n dowhile ap <= n and t[ap] < offset + a doap = ap + 1endif n < ap thenbp = apelsewhile bp <= n and t[bp] < t[ap] + b dobp = bp + 1endendif n < bp thencp = bpelsewhile cp <= n and t[cp] < t[bp] + c docp = cp + 1endendif ap <= n and bp <= n and cp <= nand t[cp] - t[bp] == cand t[bp] - t[ap] == band t[ap] - offset == a thenret = ret + 1endoffset = t[i]endprint(ret)