名称: 线段树构建器 描述: 生成定制的线段树实现 允许的工具:
- 读取
- 写入
- 搜索
- 通配符匹配
- 编辑
线段树构建器技能
目的
为各种合并函数生成定制的线段树实现,支持惰性传播和高级变体。
功能
- 为自定义合并函数生成线段树
- 惰性传播模板生成
- 持久化线段树变体
- 二维线段树生成
- 用于复杂更新的线段树beats
- 迭代与递归实现
目标流程
- 线段树实现
- 范围查询优化
- 数据结构实现
线段树变体
- 基础型: 点更新,范围查询
- 惰性传播: 范围更新,范围查询
- 持久化: 版本历史保留
- 二维线段树: 二维范围查询
- 线段树Beats: 复杂范围更新 (chmin, chmax)
- 归并排序树: 范围顺序统计
输入模式
{
"type": "object",
"properties": {
"mergeFunction": { "type": "string" },
"identity": { "type": "string" },
"updateType": {
"type": "string",
"enum": ["point", "range", "both"]
},
"lazyPropagation": { "type": "boolean" },
"variant": {
"type": "string",
"enum": ["basic", "lazy", "persistent", "2d", "beats"]
},
"language": {
"type": "string",
"enum": ["cpp", "python", "java"]
},
"style": {
"type": "string",
"enum": ["recursive", "iterative"]
}
},
"required": ["mergeFunction", "identity"]
}
输出模式
{
"type": "object",
"properties": {
"success": { "type": "boolean" },
"code": { "type": "string" },
"complexity": { "type": "object" },
"usage": { "type": "string" }
},
"required": ["success", "code"]
}