上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 21 下一页
Connections in Galaxy WarTime Limit:3 Seconds Memory Limit:32768 KBIn order to strengthen the defense ability, many stars in galaxy allied together and built many bidirectional tunnels to exchange messages. However, when the Galaxy War began, some tunnels were destroyed by the monsters from another Read More
posted @ 2013-04-14 14:41 free斩 Views(256) Comments(0) Diggs(1) Edit
How Many Answers Are WrongTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1384Accepted Submission(s): 562Problem DescriptionTT and FF are ... friends. Uh... very very good friends -________-bFF is a bad boy, he is always wooing TT to play the follo Read More
posted @ 2013-04-14 13:31 free斩 Views(359) Comments(1) Diggs(0) Edit
题意:给你 N 件不同的商品,每件商品最多可以买一次。 每件物品对应两个值 pi di pi 表示物品的价值,di 表示可以买的最迟时间(也就是第一天到第 di 天都可以买这件物品) 规定:每天最多可以买一件物品,问你可以得到的最大价值。算法:贪心 看了KB神的题解,他用的并查集,等下贴个代码。思路【贪心版本】:将物品按照价值从大到小排序 依次枚举每件物品 从可以买的最后一天枚举,看是否可以买 注意:标记天数。思路【KB的并查集版本】:将物品按照价值从大到小排序 处理的时候选择最后的一个不冲突点。 ... Read More
posted @ 2013-04-14 12:41 free斩 Views(261) Comments(0) Diggs(0) Edit
A Bug's LifeTime Limit:10000MSMemory Limit:65536KTotal Submissions:23484Accepted:7639DescriptionBackgroundProfessor Hopper is researching the sexual behavior of a rare species of bugs. He assumes that they feature two different genders and that they only interact with bugs of the opposite gender Read More
posted @ 2013-04-14 12:13 free斩 Views(156) Comments(0) Diggs(0) Edit
算法:并查集。题意:给你 N 个农场 给定 M 条关系 :x y len dir 表示农场 y 在农场 x 的 dir 方向的 len 米处 输入 Q 个问题:x y index 在知道从从第一条关系到第 index 条关系的情况下,判断农场 x 和农场 y 的相对关系。 如果能判断,则输出相对关系:水平距离差 + 垂直距离差 如果不能判断,则输出 -1.注意:每组测试数据中的每个问题中的 index 是按照从小到大的顺序给出的,所以使得问题简单化。思路:p[] 记录父亲节... Read More
posted @ 2013-04-13 18:56 free斩 Views(159) Comments(0) Diggs(0) Edit
Wireless NetworkTime Limit:10000MSMemory Limit:65536KTotal Submissions:13361Accepted:5659DescriptionAn earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computers, but an unexpected aftershock attacked, all computers in the n Read More
posted @ 2013-04-13 13:07 free斩 Views(216) Comments(0) Diggs(0) Edit
Cube StackingTime Limit:2000MSMemory Limit:30000KTotal Submissions:15951Accepted:5448Case Time Limit:1000MSDescriptionFarmer John and Betsy are playing a game with N (1 const int maxn = 30000+10; int p[maxn]; int r[maxn]; //下面的个数 int sum[maxn]; //总个数 int find(int x) { if(x == p[x]) return x;... Read More
posted @ 2013-04-13 11:47 free斩 Views(230) Comments(0) Diggs(0) Edit
FibonacciTime Limit:1000MSMemory Limit:65536KTotal Submissions:6881Accepted:4873DescriptionIn the Fibonacci integer sequence,F0= 0,F1= 1, andFn=Fn− 1+Fn− 2forn≥ 2. For example, the first ten terms of the Fibonacci sequence are:0, 1, 1, 2, 3, 5, 8, 13, 21, 34, …An alternative formula for the Fibonacc Read More
posted @ 2013-04-09 21:14 free斩 Views(203) Comments(0) Diggs(0) Edit
转载来自:http://www.cnblogs.com/huangfeihome/archive/2012/09/07/2675123.html并查集。 首先,以为k个询问中的I是乱序的,直接被吓傻了,后来看讨论版才发现I是升序的…… 这道题让我对并查集有一个新的认识:根的代表性是非常强的!并查集里如果某个节点的改动会影响到整个并查集的所有节点,那么,在union_set的时候只需要改动根节点就可以了,当然,在find_set函数里要对所有节点进行更新(这相当于一种延时标记)。我们知道,find_set函数走了两条路,一条是前往根的路,一条是从跟返回的路,那么,如果发现根已经被改动,必须在.. Read More
posted @ 2013-04-08 21:54 free斩 Views(162) Comments(0) Diggs(0) Edit
Find them, Catch themTime Limit:1000MSMemory Limit:10000KTotal Submissions:23915Accepted:7167DescriptionThe police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in the city, Gang Dragon and Gang Snake. However, the police first needs to identify whi Read More
posted @ 2013-04-08 19:04 free斩 Views(318) Comments(0) Diggs(0) Edit
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 21 下一页