結果
| 問題 |
No.1471 Sort Queries
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2021-05-04 21:33:59 |
| 言語 | Lua (LuaJit 2.1.1734355927) |
| 結果 |
AC
|
| 実行時間 | 16 ms / 2,000 ms |
| コード長 | 470 bytes |
| コンパイル時間 | 201 ms |
| コンパイル使用メモリ | 7,068 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-23 16:51:19 |
| 合計ジャッジ時間 | 2,321 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
local n, q = io.read("*n", "*n", "*l")
local s = io.read()
local t = {}
for i = 1, 26 do
t[i] = {0}
end
for i = 1, n do
local b = s:byte(i) - 96
for j = 1, 26 do
if b == j then
t[j][i + 1] = t[j][i] + 1
else
t[j][i + 1] = t[j][i]
end
end
end
for iq = 1, q do
local l, r, x = io.read("*n", "*n", "*n")
for i = 1, 26 do
local z = t[i][r + 1] - t[i][l]
if x <= z then print(string.char(96 + i)) break end
x = x - z
end
end