摘要: class FenwTree { int n; vector<int> c; public: FenwTree(int size) { n=size; c.assign(n+1, 0); } void update(int tag, int delta) {//单点修改 while (tag <= 阅读全文
posted @ 2025-07-20 16:45 chhhcooh 阅读(9) 评论(0) 推荐(0)
摘要: vector<int> d1(n+1,1e18),d2(n+1,1e18);//dis数组 d1[1]=0;//起点初始化为1 priority_queue<pair<int,int>> q;//优先队列用于找每次dis最小的node q.push({0,1});//第一维是dis*-1(把大根堆当 阅读全文
posted @ 2025-06-21 00:32 chhhcooh 阅读(18) 评论(0) 推荐(0)
摘要: 概述 字典树就是一颗多叉树 根节点为空 其余节点表示一个字符 而一条从根节点开始的路径可以表示一个字符串 基本操作 插入字符串 void insert(string s) { int p=0;//从根节点开始 p初始化为0(根节点编号为0 for(int i=0;i<s.size();i++) { 阅读全文
posted @ 2025-06-12 22:08 chhhcooh 阅读(15) 评论(0) 推荐(0)