C. Money Transfers time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are n banks in the city where Vasya lives, they are located in a circle, such that any two banks are neighbouring if…
11.07图论水题Test 题目 描述 做法 \(BSOJ6378\) 在\(i\)位置可以到\(i+a_i\)或\(i+b_i\)求\(1\rightarrow n\)字典序最小路径 判可达性后贪心\(dfs\) \(BSOJ5154\) 过长 裸的期望\(dp\) \(BSOJ5155\) 多次询问:树上路径\(x\)到\(y\),初始\(c\)元,每次碰到比当前最大值大的就买,求购买次数 倍增预处理,二分 \(T1\) 注意数组含义(\(vis\&able\)) \(T2\) 注意概率不是…
题目是来自HZW的博客(构造题我是各种不会...) Solved 1 / 1 A CodeForces 500A New Year Transportation Solved 1 / 1 B CodeForces 437C The Child and Toy Solved 1 / 2 C CodeForces 510C Fox And Names Solved 1 / 3 D CodeForces 475B Strongly Connected City Solved 1 / 2 E CodeF…
D. Vanya and Treasure time limit per test 1.5 seconds memory limit per test 256 megabytes input standard input output standard output Vanya is in the palace that can be represented as a grid n × m. Each room contains a single chest, an the room locat…
C. Vasya and String time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output ->  Link  <- 题目就不贴出来了,链接在上面: 题意:给定n,k,然后是一个长度为n的只含字母a.b的字符串,问至多改变k次使得一个子串字母都相同且长度最大,如所给样例: input 10 1 bbabbabbba output…
A. Jumping Ball time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output In a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. T…
转自——http://blog.csdn.net/qwe20060514/article/details/8112550 =============================以下是最小生成树+并查集======================================[HDU]1213   How Many Tables   基础并查集★1272   小希的迷宫   基础并查集★1325&&poj1308  Is It A Tree?   基础并查集★1856   More i…
题目链接: http://codeforces.com/problemset/problem/332/C 题目意思: 有n个命令,要通过p个,某主席要在通过的p个中选择k个接受. 每个任务有两个值ai,bi, ai表示如果该主席接受该命令,她的头发变灰的数量,bi表示如果该主席不接受该命令时,议员不高兴值. 对于通过的p个命令,该主席要使议员的不高兴值和最小,在相同的情况下,要使自己的头发变灰的数量尽可能的少. 让你求出通过哪p个命令,使得该主席的头发变灰的数量最多,在相同的情况下,输出使议员不…
由于我这个破题提交了十四五遍,所以我决定写篇博客来记录一下. 这个题的题目描述是这样的 首先一看这个题我瞬间就想到了一笔画问题(欧拉回路). 对于能够一笔画的图,我们有以下两个定理. 定理1:存在欧拉路的条件:图是连通的,有且只有2个奇点. 定理2:存在欧拉回路的条件:图是连通的,有0个奇点. 求欧拉路的算法很简单,使用深度优先遍历即可.时间复杂度O(m+n) #include<iostream> #include<cmath> using namespace std; ] ={}…
1.白银莲花池 LUOGU 2411 第一种思路:当然我们可以写三个bfs a掉这个题,这写下来一二百行要有了吧: 第二种:我们可以在一个bfs中维护所有的信息,一个方向数组,从起点开始,向八个方向扩展,如果添加的莲花需要少,就更新当前的值,如果添加莲花一样多但所需步数更少,也更新,目标点方案数等于当前点方案数.特别地,如果添加莲花和步数一样多,目标点方案数加上当前点方案数.以上三种情况目标点皆需入队: int add[50][50],bs[50][50],vis[50][50],sx,sy,t…