Home PageWeb BoardProblemsStandingStatusStatisticsAward Contest

Contest - POJ Founder Monthly Contest – 2007.11.25

Start time:  2007-11-25 12:00:00  End time:  2007-11-25 17:00:00
Current System Time:  2025-01-24 16:36:11.058  Contest Status:   Ended

Problem ID Title
3464 Problem A Approximations
3465 Problem B Battle
3466 Problem C Distance to the Prey
3467 Problem D Cross Counting
3468 Problem E A Simple Problem with Integers
3469 Problem F Dual Core CPU
3470 Problem G Walls
3471 Problem H Integral Roots

[Standings]  [Status]  [Statistics]

Contest Report

Problem A: Approximations

First let us consider a slightly different problem. We replace rounding with truncation. It shall not be difficult to figure out a solution that uses a trie. It can be proved that x can be chosen to coincide with one of the given fractions.

Now consider the original problem. Rounding makes it more complicated since all approximations of a set of fractions do not necessarily form a tree structure. Nor does the aforementioned lemma hold in this case. However, scrutinizing a solution to the problem using truncation, we can discover that it does not rely on the relation between any two approximations of a fraction. Consequently, we can still use a trie. What makes the difference it that when working a node representing some fraction f of accuracy a, we have to additionally set counters to count the fractions hitting the two intervals [fa2, f) and [f, f + a2). The want x can then be chosen accordingly to coincide with some fraction that has a corresponding node in the trie.

Problem B: Battle

In the i-th round (1 ≤ iN), depending on whether you attack there can be two possible outcome concerning you and Heilong's HP. If you attack, your HP decreases by Ai and that of Heilong decreases by x; otherwise your HP increases by max{yAi, 0} while that of Heiling remains unchanged. Based on this analysis, a solution proceeds in a greedy way: whenever possible, you attack; only when your remaining HP cannot stand the next attack by Heiling, retract some past decisions of attackting and change them to defending or healing in light of the gain of HP.

Problem C: Distance to the Prey

Now that the web is recursively quinquepartite, the method of solution is thus recursive quinquesection. First we determine the smallest Sk that contains Zhizhu and its prey’s locations. If the two locations are contained in some portion in the web of the shape of Sk − 1, we are then encountered a problem with reduced scale. Otherwise, a path can be directly constructed. (This latter case might be nontrivial.)

Problem D: Cross Counting

Keep track of the size of largest cross centered at each cell in each step using dynamic programming. A solution that handles each step in O(N + M) time will suffice.

Problem E: A Simple Problem with Integers

An efficient solution uses the segment tree. Each node represents a contiguous segment of integers, keeping track of their sums. Operations of increasing the integers are deferred with the increments properly stored in the tree and not explicitly computed until some query involves the corresponding nodes.

Problem F: Dual Core CPU

Any assignment of the modules to the two cores can be modeled by a cut in the flow network G = (N, A) where N = {s, t} ∪ {1, 2, …, N} and A = {(<s, i>, Ai) | 1 ≤ iN} ∪ {(<i, t>, Bi) | 1 ≤ iN} ∪ {(<a, b>, w), (<b, a>, w) | a cost w has to be charged if modules a and b are assigned to different cores}. By the max-flow-min-cut theorem. the desired answer equals the value of the maximum flow from s to t.

Problem G: Walls

We can use an offline algorithm which scans the walls in each of the four directions to find the minimum time that Xiaoniao hits a wall. During each scan, a segment tree is used to record whether some wall stands in the way of Xiaoniao’s flight and the position of the closest one of such walls. Besides, special check has to be done to deal with circumstances where space wraps around.

Problem H: Integral Roots

Factorize a0 and test its factors as candidates of the integral roots.

Home Page Go Back To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator