数据结构
JayGram
这个作者很懒,什么都没留下…
展开
-
CF1446:Xor Tree(字典树好题)
题目链接#include <bits/stdc++.h>using namespace std;const int maxn=2e5+5;int a[maxn];int n,idx;int son[maxn*35][2];int f[maxn*35];void insert(int x){ int p=0; for(int i=31;i>=0;i--){ int t=(x>>i)&1; if(!s.原创 2022-05-08 22:13:01 · 169 阅读 · 0 评论 -
CF:1626C. Monsters And Spells
题目链接题解:从后往前枚举,每个点所跨越的维度为p=k[i]-h[i]+1,即p为i点至少的起点。记录每个点的起点后。从n-1点往前遍历;假如遍历到i点,判断i+1的起点是否覆盖了k[i],若覆盖了,则i和i+1的起点为两者起点的最小值,后面同理。所以相当于维护一些连通块。用并查集维护。#include <bits/stdc++.h>using namespace std;typedef long long LL;const int maxn=105;int n;原创 2022-05-02 21:15:06 · 149 阅读 · 0 评论 -
牛客:NC25138子串查询(字符串专题)
链接:NC25138子串查询原创 2022-03-22 21:54:14 · 299 阅读 · 0 评论 -
TZOJ:5899桃子的主席树(主席树+LCA+离散化)
题目链接:桃子的主席树题目:样例输入:8 5105 2 9 3 8 5 7 71 21 31 43 53 63 74 82 5 10 5 210 5 311 5 4110 8 2样例输出2891057没学过主席树的话,最好先去学一下主席树,这道题并不是板子题。板子题的话可以看AcWing中的第k小数此处链接:AcWing255.第K小数以样例为参照,描述该题的解题过程:若以1为根节点,那么树的形状就如上图。那.原创 2022-03-09 12:38:54 · 208 阅读 · 0 评论