05 2012 档案
摘要:最近公共祖先(Least Common Ancestors)LCA定义:对于有根树T的两个结点u、v,最近公共祖先LCA(T,u,v)表示一个结点x,满足x是u、v的祖先且x的深度尽可能大。另一种理解方式是把T理解为一个无向无环图,而LCA(T,u,v)即u到v的最短路上深度最小的点。离线算法Tarjan: 利用并查集优越的时空复杂度,我们可以实现LCA问题的O(n+Q)算法,这里Q表示询问的次数。Tarjan算法基于深度优先搜索的框架,对于新搜索到 的一个结点,首先创建由这个结点构成的集合,再对当前结点的每一个子树进行搜索,每搜索完一棵子树,则可确定子树内的LCA询问都已解决。其他的LCA.
阅读全文
摘要:Junk-Mail FilterTime Limit: 15000/8000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3547Accepted Submission(s): 1079Problem DescriptionRecognizing junk mails is a tough task. The method used here consists of two steps:1) Extract the common characteristics from the in
阅读全文
摘要:Cow RelaysTime Limit:1000MSMemory Limit:65536KTotal Submissions:3507Accepted:1388DescriptionFor their physical fitness program,N(2 ≤N≤ 1,000,000) cows have decided to run a relay race using theT(2 ≤T≤ 100) cow trails throughout the pasture.Each trail connects two different intersections (1 ≤I1i≤ 1,0
阅读全文
摘要:Purifying MachineTime Limit : 4000/2000ms (Java/Other) Memory Limit : 131072/65536K (Java/Other)Total Submission(s) : 1 Accepted Submission(s) : 1Problem DescriptionMike is the owner of a cheese factory. He has 2N cheeses and each cheese is given a binary number from 00...0 to 11...1. To keep his ch
阅读全文
摘要:无题II Time Limit : 2000/2000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Total Submission(s) : 11 Accepted Submission(s) : 7 Problem Description 这是一个简单的游戏,在一个n*n的矩阵中,找n个数使得这n个数都在不同的行和列...
阅读全文
摘要:Jamie's Contact Groups Time Limit: 15000/7000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others) Total Submission(s): 171 Accepted Submission(s): 46 Problem Description Jamie ...
阅读全文
摘要:SwapTime Limit : 2000/1000ms (Java/Other)Memory Limit : 32768/32768K (Java/Other)Total Submission(s) : 3Accepted Submission(s) : 2Special JudgeProblem DescriptionGiven an N*N matrix with each entry equal to 0 or 1. You can swap any two rows or any two columns. Can you find a way to make all the diag
阅读全文
摘要:Strategic GameTime Limit : 20000/10000ms (Java/Other)Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 4Accepted Submission(s) : 3Problem DescriptionBob enjoys playing computer games, especially strategic games, but sometimes he cannot find the solution fast enough and then he is very sa
阅读全文
摘要:Rain on your ParadeTime Limit : 6000/3000ms (Java/Other)Memory Limit : 655350/165535K (Java/Other)Total Submission(s) : 3Accepted Submission(s) : 2Problem DescriptionYou’re giving a party in the garden of your villa by the sea. The party is a huge success, and everyone is here. It’s a warm, sunny ev
阅读全文
摘要:ArbiterTime Limit : 1000/1000ms (Java/Other)Memory Limit : 131072/131072K (Java/Other)Total Submission(s) : 2Accepted Submission(s) : 2Problem DescriptionArbiter is a kind of starship in the StarCraft science-fiction series. The Arbiter-class starship is a Protoss warship specializing in providing p
阅读全文
摘要:Taxi Cab SchemeTime Limit : 20000/10000ms (Java/Other)Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 3Accepted Submission(s) : 3Problem DescriptionRunning a taxi station is not all that simple. Apart from the obvious demand for a centralised coordination of the cabs in order to pick u
阅读全文
摘要:I'm Telling the TruthTime Limit : 2000/1000ms (Java/Other)Memory Limit : 32768/32768K (Java/Other)Total Submission(s) : 2Accepted Submission(s) : 2Problem DescriptionAfter this year’s college-entrance exam, the teacher did a survey in his class on students’ score. There are n students in the cla
阅读全文

浙公网安备 33010602011771号