######数据结构######
至此曾经
从未坚持?
展开
-
计蒜客 query on a string
You have two strings SS and TT in all capitals.Now an efficient program is required to maintain a operation and support a query.The operation C~i~chC i ch with given integer ii and capital let原创 2017-09-13 17:57:10 · 233 阅读 · 0 评论 -
LA4487 加权并查集
点击打开链接异或具有很多奇妙的性质: - aa ^ bb = bb ^ aa; - (aa ^ bb) ^ cc = aa ^ (bb ^ cc); - 若aa ^ bb = cc,那么aa ^ cc = bb。若XpXp XORXOR XqXq = vv,那么我们可以把XpXp与XqXq连一条边,权值为vv。 若XpXp = vv,那么就有XpXp XORXOR 00 = vv,所以我们可以把X...原创 2018-05-06 20:45:46 · 278 阅读 · 0 评论 -
Beauty of Trees 2018华中科技大学程序设计竞赛决赛同步赛A
It’s universally acknowledged that there’re innumerable trees in the campus of HUST. One day the tree manager wants to play a game with you. There are N trees lining up in a straight road. The beauty ...原创 2018-05-06 21:29:11 · 422 阅读 · 0 评论 -
Nowcoder 第十四届华中科技大学程序设计竞赛决赛同步赛 M
It’s universally acknowledged that there’re innumerable trees in the campus of HUST. In 8102, Alisa took fishing as her business. When she was walking along the bank and forgot the distance gradually,...原创 2018-05-08 12:38:41 · 386 阅读 · 3 评论 -
“浪潮杯”第九届山东省ACM大学生程序设计竞赛 D-Dance
链接:https://www.nowcoder.com/acm/contest/123/D来源:牛客网题意:在根节点为0的树上(编号:0,1,2...n)。一条边上有两个值 poweri ,numi,相当于网络流:poweri相当于路上的cost,numi相当于容量,相当于汇点为0,源点为所有叶子节点,求最大费用。样例:70 100 01 2 32 2 51 5 12 1 33 2 44 3 2输...原创 2018-05-31 14:46:10 · 481 阅读 · 0 评论 -
Wannafly挑战赛15 A-最小化价格
链接:https://www.nowcoder.com/acm/contest/112/A来源:牛客网现有n组人,m个地点,给出每组人的人数,每个地点可容纳的最大人数和选择的价格要求一种方式,使得每组人都到一个各不相同的地点,最小化选择的价格每个队伍的人都要在同一个地方每个地方只能有一个队伍输入:3 42 3 41 22 33 44 5输出:12被自己菜...原创 2018-05-31 18:51:57 · 187 阅读 · 0 评论 -
牛客网暑期ACM多校训练营(第二场)J farm
题意:给一个矩阵每个格子里有一个数,现在给T个 子矩阵 和一个 val 值,把子矩阵里不是 val 值的 格子抹去,问最多抹去多少个格子。题解:1:先考虑一个特殊的情况:矩形中的数和T次操作放的数都为0或1。 对于这种情况,我们只需要用矩阵前缀和统计一下每个格子被多少个0覆盖,被多少个1覆盖。 如果一个格子的数为0且被放入了至少一个1或这个格子的数位1且被放入了至少一个0则就会对答案产生贡...原创 2018-07-24 16:15:30 · 171 阅读 · 0 评论 -
牛客网暑期ACM多校训练营(第一场)J Different Integers
题目:链接:https://www.nowcoder.com/acm/contest/139/J来源:牛客网Given a sequence of integers a1, a2, ..., an and q pairs of integers (l1, r1), (l2, r2), ..., (lq, rq), find count(l1, r1), count(l2, r2), ......原创 2018-07-20 14:45:43 · 185 阅读 · 0 评论 -
2018 Multi-University Training Contest 2 Naive Operations
题意:In a galaxy far, far away, there are two integer sequence a and b of length n.b is a static permutation of 1 to n. Initially a is filled with zeroes.There are two kind of operations:1. add ...原创 2018-07-31 16:57:00 · 114 阅读 · 0 评论 -
2018 Multi-University Training Contest 5 Glad You Came
题目:http://acm.hdu.edu.cn/showproblem.php?pid=6356用线段树维护一个最小最大值搞一下可以过:#include<iostream>#include<stdio.h>#include<string.h>#include<algorithm>#include<vector>#de...原创 2018-08-06 21:19:47 · 117 阅读 · 0 评论 -
Five Day Couple “今日头条杯”首届湖北省大学程序设计竞赛(网络同步赛)
Mingming, a cute girl of ACM/ICPC team of Wuhan University, is alone since graduate from high school. Last year, she used a program to match boys and girls who took part in an active called Boy or Gir...原创 2018-05-06 18:29:16 · 161 阅读 · 0 评论 -
Nowcode Sum(Wannafly模拟赛4)
考虑维护一个这样的问题:(1) 给出一个数组A,标号为1~n(2) 修改数组中的一个位置。(3) 询问区间[l,r]中所有子集的位运算and之和mod(109+7)。位运算and即为“pascal中的and”和“C/C++中的&”我们定义集合S={ l , l+1 , ... , r-1 , r}若集合T,T ∩ S = T,则称T为S的子集设f(T)=AT1 and原创 2017-10-22 22:24:25 · 343 阅读 · 0 评论 -
hdu 6215 Brute Force Sorting
Problem DescriptionBeerus needs to sort an array of N integers. Algorithms are not Beerus's strength. Destruction is what he excels. He can destroy all unsorted numbers in the array simultaneously.原创 2017-09-17 20:02:30 · 250 阅读 · 0 评论 -
hdu 6183 【线段树的巧妙】
Do you like painting? Little D doesn't like painting, especially messy color paintings. Now Little B is painting. To prevent him from drawing messy painting, Little D asks you to write a program to ma原创 2017-09-28 20:44:23 · 236 阅读 · 0 评论 -
hdu 5685 Problem A
Problem Description度熊手上有一本字典存储了大量的单词,有一次,他把所有单词组成了一个很长很长的字符串。现在麻烦来了,他忘记了原来的字符串都是什么,神奇的是他竟然记得原来那些字符串的哈希值。一个字符串的哈希值,由以下公式计算得到:H(s)=∏i≤len(s)i=1(Si−28) (mod 9973)Si代表 S[i] 字符的 ASCII 码。请帮助原创 2016-11-22 16:55:43 · 205 阅读 · 0 评论 -
hdu 5687 Problem C
Problem Description度熊手上有一本神奇的字典,你可以在它里面做如下三个操作:1、insert : 往神奇字典中插入一个单词2、delete: 在神奇字典中删除所有前缀等于给定字符串的单词3、search: 查询是否在神奇字典中有一个字符串的前缀等于给定的字符串Input这里仅有一组测试数据。第一行输入一个正整数N(1≤N≤10000原创 2016-11-22 13:24:00 · 218 阅读 · 0 评论 -
hdu 5688 Problem D
Problem Description度熊所居住的 D 国,是一个完全尊重人权的国度。以至于这个国家的所有人命名自己的名字都非常奇怪。一个人的名字由若干个字符组成,同样的,这些字符的全排列的结果中的每一个字符串,也都是这个人的名字。例如,如果一个人名字是 ACM,那么 AMC, CAM, MAC, MCA, 等也都是这个人的名字。在这个国家中,没有两个名字相同的人。度熊想统计这个国家的人口原创 2016-10-24 13:08:04 · 294 阅读 · 0 评论 -
hdu 1394 Minimum Inversion Number
Problem DescriptionThe inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i aj.For a given sequence of numbers a1, a2, ..., an, if we move th原创 2016-11-13 20:21:34 · 199 阅读 · 0 评论 -
UVALive 4329 (树状数组)
N (3 ≤ N ≤ 20000) ping pong players live along a west-east street(consider the street as a line segment).Each player has a unique skill rank. To improve their skill rank, they often compete with eac原创 2016-11-22 21:37:03 · 300 阅读 · 0 评论 -
poj---Relative Relatives
一道基础的数据结构水题,但是还是不能一y。总结:调用STL还是不熟练,map.count( string);一种形式。 使用 memset时有错误,把结构体string初始化时运行错误,修改一下就行了。根据自己试验: memse不能被 string 使用,char字符串和数组可以使用。string使用时会运行错误。 cha原创 2016-08-10 09:10:34 · 383 阅读 · 0 评论 -
Power Strings --KMP
/****DescriptionGiven two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of concatenation as multiplication, ex原创 2016-07-25 16:33:06 · 247 阅读 · 0 评论 -
2018 Multi-University Training Contest 10 - Problem E. TeaTree (树上 dsu // 线段树合并)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=6430题意:一棵树上每个节点权值为v[i],每个节点的heard值是:以它为LCA的两个节点的GCD的最大值,要求输出每个节点的heard值题解:小于 100000 的数最多只有一百多个约数. 建出所有点的约数线段树, 然后线段树合并, 重复的单点就可以对答案产生贡献. 当然有省内存的做法, DSU...原创 2018-08-24 15:12:50 · 148 阅读 · 0 评论