Problem It’s opening night at the opera, and your friend is the prima donna (the lead female singer). You will not be in the audience, but you want to make sure she receives a standing ovation – with every audience member standing up and clapping the…
Problem It’s opening night at the opera, and your friend is the prima donna (the lead female singer). You will not be in the audience, but you want to make sure she receives a standing ovation – with every audience member standing up and clapping the…
本题的 Large dataset 本人尚未解决. https://code.google.com/codejam/contest/90101/dashboard#s=p2 Problem So you've registered. We sent you a welcoming email, to welcome you to code jam. But it's possible that you still don't feel welcomed to code jam. That's w…
https://code.google.com/codejam/contest/90101/dashboard#s=p1 Problem Geologists sometimes divide an area of land into different regions based on where rainfall flows down to. These regions are called drainage basins. Given an elevation map (a 2-dimen…
https://code.google.com/codejam/contest/90101/dashboard#s=p0 Problem After years of study, scientists at Google Labs have discovered an alien language transmitted from a faraway planet. The alien language is very unique in that every word consists of…
题意:给出一个键盘,按键都是大写字母.给出一个目标单词和一个长度L.最大值或者最大长度都是100.现在随机按键盘,每个按键的概率相同. 敲击出一个长度为L的序列.求该序列中目标单词最多可能出现几次,期望出现几次.输出两者的差. 分析:概率题 先求最大次数.直接看该目标单词首尾最大重叠多长,暴力求解即可.然后通过除法运算求最多出现几次. 求期望涉及到一个Linearity of Expecation的知识,用中文形象的描述可以称之为“期望重组”. 期望重组 现有随机变量X,传统求X期望的方法是把X…
题意:给出若干个句子,每个句子包含多个单词.确定第一句是英文,第二句是法文.后面的句子两者都有可能.两个语种会有重复单词. 现在要找出一种分配方法(给每个句子指定其文种),使得既是英文也是法文的单词数量最少. 分析:网络流的最小割. 建图方法如下,每个句子一个点.每个单词一个点.句子向其所属的单词连双向无穷流量边.把第一个句子作为起点,第二句作为终点. 现在我们要割掉一些单词,使得起点无法到达终点. 图的意义是这样的.如果我们能找到一条从起点到达终点的通路,那么中间一定有一个过程是从一个英文句子…
快一年没有做题了, 今天跟了一下 GCJ Round 1A的题目, 感觉难度偏简单了, 很快搞定了第一题, 第二题二分稍微考了一下, 还剩下一个多小时, 没仔细想第三题, 以为 前两个题目差不多可以晋级了. 切出去玩了一会, 大概剩半小时, 发现自己的排名逐渐快超 1k了, 果断决定搞出第三题的小数据. 然后简单的O(n^3)的枚举过了. 然后有惊无险的晋级了. 第一题,读懂题目,然后计算就很好说了. 第二题,计算最小公倍数的那种肯定是行不通的, 二分 t时刻 已经剪完了多少个, 正在剪的有多少…
拿下 ABD, 顺利晋级, 预赛的时候C没有仔细想,推荐C题,一个非常不错的构造题目! A Magic Trick 简单的题目来取得集合的交并 1: #include <iostream> 2: #include <algorithm> 3: #include <set> 4: #include <vector> 5: using namespace std; 6: int main() 7: { 8: freopen("A-small-attem…
Google Code Jam Qualification Round Africa 2010 的第一题,很简单. Problem You receive a credit C at a local store and would like to buy two items. You first walk through the store and create a list L of all available items. From this list you would like to b…