Game with Pearls Problem DescriptionTom and Jerry are playing a game with tubes and pearls. The rule of the game is:1) Tom and Jerry come up together with a number K.2) Tom provides N tubes. Within each tube, there are several pearls. The number of p…
Battle ships Problem DescriptionDear contestant, now you are an excellent navy commander, who is responsible of a tough mission currently.Your fleet unfortunately encountered an enemy fleet near the South Pole where the geographical conditions are ne…
Seam Carving DescriptionFish likes to take photo with his friends. Several days ago, he found that some pictures of him were damaged. The trouble is that there are some seams across the pictures. So he tried to repair these pictures. He scanned these…
Comparison of Android versionsProblem DescriptionAs an Android developer, itˇs really not easy to figure out a newer version of two kernels, because Android is updated so frequently and has many branches. Fortunately, Google identifies individual bui…
题意:给N个容器,每个容器里有一定数目的珍珠,现在Jerry开始在管子上面再放一些珍珠,放上的珍珠数必须是K的倍数,可以不放.最后将容器排序,如果可以做到第i个容器上面有i个珍珠,则Jerry胜出,反之Tom胜出. 思路:数据比较小,所以我是水过的,模拟过程 + 贪心就能过.但正解是二分图匹配,之前没接触过. 二分图匹配:解释一下第二组样例,k = 2; 从左向右,每一个能够匹配 i 的(a),就去掉 i 周围其他的边,然后再也去掉a能指向的边,计算一下共有几个能匹配的,如果是n,则Jerry胜…
题目大意:给定一个n∗n的满秩矩阵A和一个n∗n的矩阵B.求一个字典序最小的1...n的排列a满足将随意一个Ai换成Bai后矩阵A仍然满秩 我们考虑建立一个二分图.假设Ai能换成Bj.就在i−>j之间连接一条边 那么这个图怎么建呢? 考虑一个行向量Bi,我们在A中找到最小的行向量集合满足Bi能够被这些行向量线性表出,那么显然Bi仅仅能替换这些行向量 我们能够设矩阵C满足C∗A=B,那么C=B∗A−1 Ci,j≠0表示Bi的线性表出须要Aj,因此CT就是这个二分图的邻接矩阵 如今我们有了一个二分图…
嘟嘟嘟 虽然我已经会网络流了,但是还是学了一个匈牙利算法. --就跟我会线段树,但还是学了树状数组一样. 其实匈牙利算法挺暴力的.简单来说就是先贪心匹配,然后如果左部点\(i\)匹配不上了,就尝试更改前面已经匹配好的点,腾出地给他匹配. 因此对于每一个点跑一遍匈牙利算法,如果这个点匹配成功,总匹配数就加1. 感觉没啥好讲的. 关于这道题怎么做,看我这篇博客吧. #include<cstdio> #include<iostream> #include<cmath> #in…
Antenna Placement Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10518   Accepted: 5189 Description The Global Aerial Research Centre has been allotted the task of building the fifth generation of mobile phone nets in Sweden. The most s…
Asteroids Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 25232   Accepted: 13625 Description Bessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1 <= N <= 500). The grid contains K a…
[BZOJ3168][Heoi2013]钙铁锌硒维生素 Description 银河队选手名单出来了!小林,作为特聘的营养师,将负责银河队选手参加宇宙比赛的饮食.众所周知,前往宇宙的某个星球,通常要花费好长好长的时间,人体情况在这之间会发生变化,因此,需要根据每天的情况搭配伙食,来保证营养.小林把人体需要的营养分成了n种,这些营养包括但不限于铁,钙.他准备了2套厨师机器人,一套厨师机器人有n个,每个厨师机器人只会做一道菜,这道菜一斤能提供第i种营养xi微克.想要吃这道菜的时候,只要输入一个数,就…