Home PageWeb BoardProblemsStandingStatusStatisticsAward Contest

Contest - POJ Monthly--2007.09.09

Start time:  2007-09-09 12:00:00  End time:  2007-09-09 17:00:00
Current System Time:  2025-01-24 21:04:43.730  Contest Status:   Ended

Problem ID Title
3371 Problem A Flesch Reading Ease
3372 Problem B Candy Distribution
3373 Problem C Changing Digits
3374 Problem D Cake Share
3375 Problem E Network Connection
3376 Problem F Finding Palindromes
3377 Problem G Ferry Lanes
3378 Problem H Crazy Thairs

[Standings]  [Status]  [Statistics]

Contest Report

Problem A: Flesch Reading Ease

A simple statistic problem. Implement the formula straight forward.

Problem B: Candy Distribution

This is a problem on number theory. You can prove that the answer is "YES" if and only if such N is a power of 2.

Problem C: Changing Digits

By changing last five digits of n through 00000 to 99999, it is sure that there's at least one number satisfying the property 1 and 2. Thus, we've got an upper bound of the number of difference between m and n. And then, a quite straight forward DP works with time complexity O(K log10K log10n). 

Problem D: Cake Share

Use Stern-Brocot tree to generate all the reduced fractions. Because of the symmetry, the author suggests to store part of the tree to reduce the memory used. Actually the memory limit is not strict so you can store all of them in a table.

Problem E: Network Connection

A O(NM) dynamic programming algorithm is quite apparent after sorting the computers and network interfaces by their coordinates. Furthermore, in any optimized case, for each computer the difference between the the indices of the network interfaces matching to and closest to the computer is never larger than N. So the complexity could be reduced to O(N2)

Problem F: Finding the Palindrome

In two case the combination of string p and q is a palindrome. One is that the reverse of p covers a suffix of q and the uncovered prefix of q is a palindrome, the other is that the reverse of q covers a prefix of p and the uncovered suffix of p is a palindrome. Storage all the strings in a trie. For each node i, except the children link, we record the number of string tails and the number of the strings whose suffix starting from this node is a palindrome. We call them ti and si. Then for each reversed string, we use it to search in the trie. When we reach a node i, if the left part of the reversed string is a palindrome, we add ti to the answer. If we finish one reversed string's searching in node i, we add si to the answer. It should be cared that the two situation may happen in the same time. We use extended KMP to identify whether a suffix or a prefix is a palindrome.

Problem G: Ferry Lanes

The lane of starting dock and the lane of finishing dock partition the river into three sections, say the western section, the eastern section and the middle section. An important fact is that Arthur won't cross the river more than once in both western and eastern section and  Arthur's overall direction in the middle section is from the starting dock to the finishing dock. The answer can be evaluated by combining the minimum time of the three sections.

Problem H: Crazy Thairs

It is known that we can implement an extended merge sort to evaluate the number of pairs of integer {i, j} (or the number of 2-number groups) satisfying i < j and Ai < Aj. The general idea of this problem is almost the same, which evaluates the number of 3-number groups, 4-number groups and finally 5-number groups step-by-step.

Home Page Go Back To top


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