Two Cylinders Special JudgeTime Limit: 10000/5000MS (Java/Others)Memory Limit: 128000/64000KB (Java/Others) SubmitStatisticNext Problem Problem Description In this problem your task is very simple. Consider two infinite cylinders in three-dimensional…
https://codeforces.com/gym/100608 题意: 两个人玩游戏,每个人有一个长为d的b进制数字,两个人轮流摇一个$[0,b-1]$的骰子,并将选出的数字填入自己的d个空位之中 最后数字大的人赢 有两种玩法,第一个是轮流玩,一个是第一个人玩d次之后,第二个人玩 两个人都非常聪明,求第一个人的最大胜率 $d,b<=10,(b+1)^d<=3000$ 题解: 很有意思的是,他保证了$(b+1)^d<=3000$,也就是b+1进制数字不会超过3000的大小 我们考虑暴搜…
Andrew Stankevich's Contest (1) 打一半出门了,回来才补完了...各种大数又不能上java..也是蛋疼无比 A:依据置换循环节非常easy得出要gcd(x, n) = 1而且x <= n / 2,那么把相应几种情况的最大值考虑一下就可以,各自是n % 2 = 1为n / 2, n % 4 = 0为n / 2 - 1,n % 4 = 2为n / 2 - 2 B:限制下限的最大流,建模方法为原来容量变成c - l,然后源点连到每一个点的下限和为正,每一个点下限和为负连到…
坑爹的,,组合数模板,,, 6132 njczy2010 1412 Accepted 5572 MS 50620 KB C++ 1844 B 2014-10-02 21:41:15 J - 2-3 Trees Time Limit: 12000/6000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others) SubmitStatus Problem Description 2-3 tree is an elegant data st…
真心是道水题,但找bug找的我想剁手了/(ㄒoㄒ)/~~ 注意几个坑点, 1.输入,getline(cin); / gets(); 一行输入,注意前面要加getchar();   输入运行记录的时候可以采取scanf("%d %c %d %c");的方式,因为已经说一个整型数后面只有一个空格: 2.该场没人出题时,队伍的得分是0: 某支队伍j比0场时,T[j] = 0; 3.如果前两支队伍出题数与罚时都相同,排名并列第1:后面的队伍从3开始排: 基本上没有了吧...被恶心到了.本应该出…
Time Limit: 20000/10000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others)     Special Judge Problem Description Most modern archivers, such as WinRAR or WinZIP, use modifications of Lempel-Ziv method as their primary compression algorithm. A…
ACdream 1214---矩阵连乘 Problem Description You might have noticed that there is the new fashion among rich people to have their yards tiled with black and white tiles, forming a pattern. The company Broken Tiles is well known as the best tiling company…
Rectangular Polygon Time Limit: 1000MS   Memory Limit: 256000KB   64bit IO Format: %lld & %llu Description A rectangular polygon is a polygon whose edges are all parallel to the coordinate axes. The polygon must have a single, non-intersecting bounda…
主题链接:http://115.28.76.232/problem? pid=1427 Nice Sequence Time Limit: 12000/6000MS (Java/Others)Memory Limit: 128000/64000KB (Java/Others) SubmitStatisticNext Problem Problem Description Let us consider the sequence a1, a2,..., an of non-negative int…
Sum vs Product Time Limit: 4000/2000MS (Java/Others)Memory Limit: 128000/64000KB (Java/Others) SubmitStatisticNext Problem Problem Description Peter has just learned mathematics. He learned how to add, and how to multiply. The fact that 2 + 2 = 2 × 2…
SETI Time Limit: 4000/2000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others) Submit Statistic Next Problem Problem Description Amateur astronomers Tom and Bob try to find radio broadcasts of extraterrestrial civilizations in the air. Recentl…
Beautiful People Special Judge Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others) Submit Statistic Next Problem Problem Description The most prestigious sports club in one city has exactly N members. Each of its members…
2-3 Trees Problem Description 2-3 tree is an elegant data structure invented by John Hopcroft. It is designed to implement the same functionality as the binary search tree. 2-3 tree is an ordered rooted tree with the following properties: the root an…
Data Transmission Special JudgeTime Limit: 12000/6000MS (Java/Others)Memory Limit: 128000/64000KB (Java/Others)   Problem Description Recently one known microprocessor productioner has developed the new type of microprocessors that can be used in dif…
Important Roads Special JudgeTime Limit: 20000/10000MS (Java/Others)Memory Limit: 128000/64000KB (Java/Others)     Problem Description The city where Georgie lives has n junctions some of which are connected by bidirectional roads.      Every day Geo…
http://acdream.info/problem?pid=1233 Andrew Stankevich's Contest (3) ASC 3 Royal Federation Special JudgeTime Limit: 10000/5000MS (Java/Others)Memory Limit: 128000/64000KB (Java/Others) SubmitStatisticNext Problem Problem Description The king of Fool…
http://acdream.info/problem?pid=1421 Andrew Stankevich Contest 22 TV Show Special JudgeTime Limit: 2000/1000MS (Java/Others)Memory Limit: 128000/64000KB (Java/Others) SubmitStatisticNext Problem Problem Description       Charlie is going to take part…
Nice Patterns Strike Back Time Limit: 20000/10000MS (Java/Others)Memory Limit: 128000/64000KB (Java/Others) Problem Description You might have noticed that there is the new fashion among rich people to have their yards tiled with black and white tile…
Beautiful People Special JudgeTime Limit: 10000/5000MS (Java/Others)Memory Limit: 128000/64000KB (Java/Others) SubmitStatisticNext Problem Problem Description The most prestigious sports club in one city has exactly N members. Each of its members is…
这题好坑,卡SPFA... 无奈只能用dij+优先队列了. 因为好久没有写过代码了,所以今天写dij时候突然觉得复杂度不对,dij+优先队列的复杂度是(n+m)logn,这种复杂度对于稠密图是非常慢!,而且还有超内存的可能(最坏情况要把n*n个点都存进优先队列),与我以前记得复杂度是nlogn不一样... 瞬间吓尿. 其实事实确实是这样,在采用斐波那契堆+dij时,斐波那契堆是插入复杂度为O(1),所以复杂度为nlogn+m,而普通我们用的STL种的priority_queue插入查询复杂度都是…
Problem Description       Peter is studying in the third grade of elementary school. His teacher of geometry often gives him difficult home tasks.       At the last lesson the students were studying circles. They learned how to draw circles with comp…
What's Aho-Corasick automaton? 一种多模式串匹配算法,该算法在1975年产生于贝尔实验室,是著名的多模式匹配算法之一. 简单的说,KMP用来在一篇文章中匹配一个模式串:但如果有多个模式串,需要在一篇文章中把出现过的模式串都匹配出来,就需要Aho-Corasick automaton算法了. My Understanding About Aho-Corasick automaton   我的理解:Aho-Corasick automaton = Trie + KMP…
Time Limit: 5 Seconds Memory Limit: 32768 KB Special Judge Network of Byteland consists of n servers, connected by m optical cables. Each cable connects two servers and can transmit data in both directions. Two servers of the network are especially i…
ZOJ Problem Set - 2314 Reactor Cooling Time Limit: 5 Seconds      Memory Limit: 32768 KB      Special Judge The terrorist group leaded by a well known international terrorist Ben Bladen is buliding a nuclear reactor to produce plutonium for the nucle…
贪心.能凑成一组就算一组 Unrhymable Rhymes Time Limit: 10 Seconds      Memory Limit: 32768 KB      Special Judge An amateur poet Willy is going to write his first abstract poem. Since abstract art does not give much care to the meaning of the poem, Willy is plan…
ZOJ Problem Set - 3365 Integer Numbers Time Limit: 1 Second      Memory Limit: 32768 KB      Special Judge The boy likes numbers. He has a sheet of paper. He have written a sequence of consecutive integer numbers on the sheet. The boy likes them. But…
大模拟:枚举6个方向.检查每一个0是否能移动 Puzzle Time Limit: 2 Seconds      Memory Limit: 65536 KB Little Georgie likes puzzles very much. Recently he has found a wooden triangle in the box with old toys. The side of the triangle is n inches long. The triangle is divid…
[A.韩信点兵] 结论题+模板题,用到了中国剩余定理,维基百科上讲的就比较详细,这里就不再赘述了…… 对于这题,我们先利用中国剩余定理($x \equiv \sum{(a_i m_i (m_i^{-1} \mod p_i))}\, \mod (\prod{p_i})$)找到当前人数的最小可行解$x_0$,(如果$x_0$已经超过了$N$,直接输出无解即可)这时不难证明,对于任何一个可行解,都有 $$x_i = x_0 + k \times \prod{P_i},k \in \mathbb{N}$…
DP: 边界条件:dp[0][j] = 1 递推公式:dp[i][j] = sum{dp[i-k][j] * dp[k-1][j-1] | 0<k≤i} i对括号深度不超过j的,能够唯一表示为(X)Y形式,当中X和Y能够为空,设X有k-1对括号,则相应的方案数为dp[i-k][j] * dp[k-1][j-1] Little Brackets Time Limit: 2 Seconds      Memory Limit: 65536 KB Consider all regular bracke…
ZOJ Problem Set - 2676 Network Wars Time Limit: 5 Seconds      Memory Limit: 32768 KB      Special Judge Network of Byteland consists of n servers, connected by m optical cables. Each cable connects two servers and can transmit data in both direction…