传送门 1614. National Project “Trams” Time limit: 0.5 secondMemory limit: 64 MB President has declared the development of tram service a priority national project. As a part of this project, Yekaterinburg will receive enough budget funds to carry out a…
1614. National Project "Trams" Time limit: 0.5 second Memory limit: 64 MB President has declared the development of tram service a priority national project. As a part of this project, Yekaterinburg will receive enough budget funds to carry out…
题目链接 大意: 给你一个无向图. 要求加最少的边,然后给这些无向图的边定向,使得每一个点的出入度都是偶数. 输出定向后的边数和边集. n<=10^5 m<=2*10^5 很巧妙的构造题-- 可以发现答案的下界是\(度数为奇数的点个数m + 度数为奇数的点个数/2\) 因为是无向图,度数为奇数的点不可能有奇数个,于是考虑往每两个度数为奇数的点间连一条边.于是就可以愉快地跑欧拉回路啦.跑出来后在欧拉回路上构造像\(a\rightarrow b\leftarrow c\rightarrow d -…
http://acm.hdu.edu.cn/showproblem.php? pid=4850 题意:构造长度为n的字符序列.使得>=4的子串仅仅出现一次 事实上最长仅仅能构造出来26^4+4-1= 456979 的序列,大于该数的都是不可能的.构造方法.就是那种欧拉回路的序列,此题DFS会爆栈.手动扩展栈也能够AC...... 递归形式的開始WA了.没有细调就换非递归了,后来又想了想,尽管自己电脑上执行不了.可是先把长度按小的来.然后调试代码,然后在扩大,AC了,当时错在MOD,递归的MOD应…
题目链接 \(Description\) 给定一张\(n\)个点\(m\)条边的无向图,允许有自环重边.求最少加多少条边后,其存在从\(1\)出发最后回到\(1\)的欧拉回路. 注意,欧拉回路是指要经过所有边,无边(边包括自环)连向的孤立点不需要考虑.但是\(1\)一定要经过. \(n,m\leq10^6\). \(Solution\) 如果图连通,奇度数点两两连边即可. 如果图不连通,对于每个奇度数点需要向外连一条边:没有奇度数点的连通块就随便找一个点往外连两条边.另外强制选\(1\)即可.…
Illegal spices 题目连接: http://acm.timus.ru/problem.aspx?space=1&num=1995 Description Jabba: Han, my boy, you disappoint me. Why haven't you paid me? And why did you fry poor Greedo? Han: Look, Jabba, next time you wanna talk to me, come see me yourself…
Solution \(2a>n\),一次性结束,直接输出 \(n\) \(a \geq b\),那么一直修即可,直接输出 \(n\) 否则,\(a\) 占弱势,我们考虑用 \(a\) 修一半需要的完整轮次数为 \([(n-1)/2a]\) ,那么这些轮中, \(a\) 修掉的个数为 \([n/2a]a\),而 \(b\) 修掉的个数则是 \([n/2], [n/2a]b\) 中的较小值.计算剩余量然后暴力修即可. #include <bits/stdc++.h> using namesp…
Your company was appointed to lay new asphalt on the highway of length nn. You know that every day you can either repair one unit of the highway (lay new asphalt over one unit of the highway) or skip repairing. Skipping the repair is necessary becaus…
Codeforces Round #296 (Div. 1)C. Data Center Drama Time Limit: 2 Sec  Memory Limit: 256 MBSubmit: xxx  Solved: 2xx 题目连接 http://codeforces.com/contest/528/problem/C Description The project of a data center of a Big Software Company consists of n compu…
用mongodb四年多了,从1.8版用到目前的3.4版,功能越来越强大,而且它的每一次升级带给我的都是惊喜,最近发现他的aggregation(管道)技术越来越丰富了,基本上将它提供的所有功能都集成了,故从官网上将aggregation这一页的操作阶段和表达式等进行了简单的翻译,以便一眼能直观的看出每个命令的功能,也算是自已对学习的知识进行一整理.mongodb在为aggregation提供的这些命令中,可谓算是开发了一种新语言出来了,因为语言的一些基本语法都算是有了,只是还有点简单罢了,mon…