HDU6500:Problem A. Game with string 题意: 给你一个字符串s以及它的m个子串的首尾位置,现在Alice和 Bob两个人轮流在任一子串的前面或者后面加1个字符,要求加了这个串加了一个字符之后仍然是s的子串,谁不能加了谁就输了,要你输出谁赢. 题解: 每个子串可以加的字符次数是恒定的:s串的长度-子串的长度.那么我们将所有子串可以加的次数加起来再判断奇偶就能得出答案. 傻逼多组WA了几发 代码: #include <bits/stdc++.h> using na…
Coconuts Time Limit: 9000/4500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 524    Accepted Submission(s): 151 Problem Description TanBig, a friend of Mr. Frog, likes eating very much, so he always has dreams abou…
Basic Data Structure Time Limit: 7000/3500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 872    Accepted Submission(s): 236 Problem Description Mr. Frog learned a basic data structure recently, which is called stac…
Mr. Frog's Game Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 277    Accepted Submission(s): 192 Problem Description One day, Mr. Frog is playing Link Game (Lian Lian Kan in Chinese).In this g…
Mr. Frog's Problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 312    Accepted Submission(s): 219 Problem Description One day, you, a clever boy, feel bored in your math class, and then fall…
Minimum's Revenge Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 283    Accepted Submission(s): 219 Problem Description There is a graph of n vertices which are indexed from 1 to n. For any pai…
Auxiliary Set Time Limit: 9000/4500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 873    Accepted Submission(s): 271 Problem Description Given a rooted tree with n vertices, some of the vertices are important.An au…
题目链接  2016 CCPC东北地区大学生程序设计竞赛 B题 题意  给定一个无向图和一棵树,树上的每个结点对应无向图中的一条边,现在给出$q$个询问, 每次选定树中的一个点集,然后真正被选上的是这些点以及这些点的所有祖先. 只有标号在树中真正被选上的点代表的这些原图中的边是存在的,这样就构成了一个新的图.求这个图的连通块个数. dfs整棵树,记$f[x]$为若$x$以及$x$的所有祖先被选上,那么构成的新的图的并查集) 这个实现比较简单,搜索的时候打上标记,回来的时候撤销即可. 这样预处理的…
题目链接:http://acm.hdu.edu.cn/search.php?field=problem&key=2016CCPC%B6%AB%B1%B1%B5%D8%C7%F8%B4%F3%D1%A7%C9%FA%B3%CC%D0%F2%C9%E8%BC%C6%BE%BA%C8%FC+-+%D6%D8%CF%D6%C8%FC&source=1&searchmode=source A题题目: 题意: 生成一棵最小生成树,边权值为两个节点的最小公倍数. 思路: 由最小公倍数的和最大公约…
链接http://acm.hdu.edu.cn/showproblem.php?pid=5929 题意:给你一种数据结构以及操作,和一种位运算,最后询问:从'栈'顶到低的运算顺序结果是多少 解法:根据位运算,发现出现0,结果就是1,那么就记录两端0的位置就好,中间不管出现什么,结果大部分都是1,考虑还有反转操作,使用双端队列,用flag标记反转后的情况,然后根据需要添加元素记录位置,最后根据标记,出现元素等进行讨论计算 #include <iostream> #include <dequ…