Home PageWeb BoardProblemsStandingStatusStatisticsAward Contest

Contest - POJ Monthly--2007.10.06

Start time:  2007-10-06 10:00:00  End time:  2007-10-06 15:00:00
Current System Time:  2025-01-24 21:14:20.918  Contest Status:   Ended

Best wishes and good luck to contestants of
The 2007 ACM Asia Programming Contest
Changchun Preliminary!

Problem ID Title
3415 Problem A Common Substrings
3416 Problem B Crossing
3417 Problem C Network
3418 Problem D Quadratic Functions
3419 Problem E Difference Is Beautiful
3420 Problem F Quad Tiling
3421 Problem G X-factor Chains
3422 Problem H Kaka's Matrix Travels

[Standings]  [Status]  [Statistics]

Contest Report

Problem A: Common Substrings

The basic idea is to evaluate the longest common prefix for each pair of suffixes, one from A and the other from B, and add its contribution to the answer. To avoid the force enumeration, you may sort all the suffixes in a list and  scan it, evaluating the contributes of a section of consecutive A's suffixes when we encounter a suffix of B. (Do the similar when encounter B's suffix.)

Problem B: Crossing

Sort the queries in non-descending order of x. For each query, evaluate the amounts of  points in area III, under the horizontal  line and to the left of the vertical line. You may use Segment-Tree to implement it. The answer to the query can be computed by the previous three results.

Problem C: Network

For each edge in the original tree, evaluate how many new channels contributes to creating a new route connecting the ends. If it is 0, the edge together with each new channel may destroy the network. If it is 1, the edge together with the only contributing channel can destroy the network. You may use LCA-RMQ to meet the time limit.

Problem D: Quadratic Functions

All quadratic functions have the form aix2 + 2aix + ci. Suppose aiaj .We call i is smaller than j if and only if

 aix2 + 2aix + ciajx2 + 2ajx + cj   =>  (ci - cj) ⁄ (aj - ai) ≤ x2 + 2x

Denote g(i, j) = (ci - cj) ⁄ (aj - ai)

Thus, we can maintain an index sequence p1p2, ...,  pk such that ap1 < ap2 < ... < apk and g(p1, p2) > g(p2, p3) > ... > g(pk-1pk) by using a balanced tree.

Problem E: Difference is Beautiful

First evaluate the longest perfect sequences staring at every positions. For each [L, R], find a pivot that every longest perfect sequence starting within [L, pivot-1] fits in [L, R] and the ones starting within [pivot, R] exceeds the interval. You may use RMQ to evaluate the answer for the first part.

Problem F: Quad Tiling

Noticing the transfer matrix using in the O(24 × n) Dynamic Algorithm is constant, you can get the answer by evaluating the nth power of the matrix, which can be done in O(logn).

Problem G: X-factor chains

Suppose X = p1a1 + p2a2 + ... + pmam where p1 .. pm are distinct primes. The maximum length is the sum of all ai. The number is the amount of repeatable permutations of {p1×a1, p2×a2, ... pm×am}.

Problem H: Kaka's Matrix Travels

Network Flow model is supposed to be used in this problem. Create two nodes u and v for each grid, add an arc from u to v with capability 1 and cost according to the number in that grid. Adding arcs with infinite capability and 0 cost to the neighboring grids. You may use any MinCost-MaxFlow algorithm to get the answer.

Home Page Go Back To top


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