Home PageWeb BoardProblemsStandingStatusStatisticsAward Contest

Contest - POJ Monthly--2007.08.05

Start time:  2007-08-05 12:00:00  End time:  2007-08-05 17:30:00
Current System Time:  2025-01-24 20:57:05.121  Contest Status:   Ended

Problem ID Title
3241 Problem A Object Clustering
3318 Problem B Matrix Multiplication
3319 Problem C Dragon Slayer Qualification Exam
3320 Problem D Jessica's Reading Problem
3321 Problem E Apple Tree
3322 Problem F Roll Box I
3323 Problem G Roll Box II
3324 Problem H Lucas-Lehmer Test

[Standings]  [Status]  [Statistics]

Contest Report

Problem A: Object Clustering

The problem is the same as to find the N-K smallest edge in the MST. As there are 10000 points, it is impossible even to calculate the length of all edges(10000 × 10000). But we shall see there are many edges that are impossible to be in the MST: if dij = dik + dkj, then (i,j) won't be in the tree. Then the number of edges is at most 500*2*10000, but in fact the number is much smaller. Use a simple DP or a good enum can rule out these redundant calculation. Then we use a Kruskal algorithm to construct the tree and can just get the answer when we go to the (N-K)th edge in the MST.

Problem B: Matrix Multiplication

The author gives an approximate algorithm rather than a precise one. Randomize a n ×1 matrix X, test if the equation A × B × X = C × X holds true. If it is not true we can safely say "NO" to this problem. If it is true, the possibility that  A × BX is extremely little.

Problem C: Dragon Slayer Qualification Exam

You may notice two important things in this problem:

  • Black/white rooks are independent from each other
  • You can do 2m brute search for red cells because m is small.
First step is to decide which rook you should place on each red cell. Then, you can do bipartite matching for white cells and black cells. For bipartite matching, you have two sets: a row set and a column set. You can make an edge between r in a row set and c in a column set if you can place a rook at cell (r, c).

Problem D: Jessica's Reading Problem

For every page in the book, evaluate the shortest section starting from the page that covers all the ideas. A good data structure such as heap will reduce the time complexity thus meet the time limit.

Problem E: Apple Tree

If we label the forks with their DFS-visit-time, then a sub-tree is a consecutive interval of labels. Then we can use segment-tree to handle this problem.

Problem F: Roll Box I

There're three states for the box on every cell, standing up, lying down towards right and lying down towards bottom. Therefore at most 500*500*3 states exists for the box so flood-fill  works.

Problem G: Roll Box II

Use any method to calculate a part of the plane, like [-10,10] × [-10,10]. You'll find some pattern hidden in it.

Problem H: Lucas-Lehmer Test

The solution idea is quite straightforward: evaluate the sequence {si} modulo Mp. In order to exploit the property of Mp being one less than a power of two, it is better to use binary in arbitrary precision arithmetic, which will simplify the process of taking modulo and conversion to hexadecimal.

Home Page Go Back To top


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