ACM ICPC 2008 Aizu Yoshihisa NittaChief Judge Tsuda


















![D: How to recognize Figure [1] [2] [3] 4 4 0 1 2 0 D: How to recognize Figure [1] [2] [3] 4 4 0 1 2 0](https://slidetodoc.com/presentation_image_h/c4d5d0ddde8447603a757a631d21e979/image-19.jpg)
































![I: Common Polynomial x 2 +10 x+25 …[1] x 2 +6 x+5 …[2] Subtract I: Common Polynomial x 2 +10 x+25 …[1] x 2 +6 x+5 …[2] Subtract](https://slidetodoc.com/presentation_image_h/c4d5d0ddde8447603a757a631d21e979/image-52.jpg)


- Slides: 54
ACM ICPC 2008 Aizu Yoshihisa Nitta (Chief Judge) Tsuda College
Problem Set No Title Domain Level A Grey Area Specification 1 B Expected Allowance Specification 1 C Stopped Watches Combination 2 D Digits on the Floor Graph 2. 5 E Spherical Mirrors Geometry 2. 5 F Traveling Cube Route search 3 G Search for Concatenated Strings String Match 3. 5 H Top Spinning Geometry & Simulation 4 I Common Polynomial Formula manipulation 4 J Zigzag Geometry 4
Plan to prepare problems • Each team will solve at least one problem. • Each problem will be solved by at least one team. • No team will solve all the problems. × △ ○
Problem A: Grey Area Correct team Submit 34 48 • Estimate ink consumption for printing histogram • Each bar is drawn monotonically • Darkness of each bar is decreased from left to right Histogram
A: How to Solve • 2 pass processing required Bar’s darkness Count up and Classify • Number of Categories are determined Estimate ink consumption
A: Example Data Interval=10 1 2 3 4 5 16 17 18 29 30 Table of Frequency Distribution Category Quantity Darkness 0 -9 5 1. 0 10 -19 3 0. 66667 20 -29 1 0. 33333 30 -39 1 0. 0 Histogram
Problem B: Expected Allowance Correct team Submit 32 35 • Count up occurrence of each sum of pips of n dice. • Pip of dice is between 1 and m • Calculate
B: Count up occurrence
B: Count up Occurrence 0 die Sum 0 1 2 3 4 5 6 7 8 9 10 11 12 Occurrence 1 0 0 0 1 st die: pim=1 2 3 4 5 6 Sum 1 die 0 1 2 3 4 5 6 7 8 9 10 11 12 Occurrence 0 1 1 1 0 0 0
B: Count up Occurrence 1 die 1 st die Sum 0 1 2 3 4 5 6 7 8 9 10 11 12 Occurrence 0 1 1 1 0 0 0 0 1 2 3 + 4 5 6 7 8 9 10 11 12 Occurrence 0 0 1 1 1 0 0 0 2 nd die: pip=1 Sum 2 dice 2 nd die: init Sum 0 1 2 3 4 5 6 7 8 9 10 11 12 Occurrence 0 0 0 0
B: Count up Occurrence 1 die 1 st die Sum 0 1 2 3 4 5 6 7 8 9 10 11 12 Occurrence 0 1 1 1 0 0 0 0 1 2 3 4 + 5 6 7 8 9 10 11 12 Occurrence 0 0 1 2 2 2 0 0 2 nd die: pip=2 Sum 2 dice 2 nd die: pip<=1 Sum 0 1 2 3 4 5 6 7 8 9 10 11 12 Occurrence 0 0 1 1 1 0 0 0
B: Count up Occurrence 1 die 1 st die Sum 0 1 2 3 4 5 6 7 8 9 10 11 12 Occurrence 0 1 1 1 0 0 0 0 1 2 3 4 5 + 6 7 8 9 10 11 12 Occurrence 0 0 1 2 3 3 3 1 0 0 0 2 nd die: pip=3 Sum 2 dice 2 nd die: pip<=2 Sum 0 1 2 3 4 5 6 7 8 9 10 11 12 Occurrence 0 0 1 2 2 2 0 0
Problem C: Stopped Watches Correct team Submit 20 23 • Search the appropriate interpretation of watches.
C: Relations between h and m
C: Search Space • Permutations of (s, t, u) equals 3! = 6 • For each permutation of (s, t, u), (h, m, second) is assigned and checked. • for given h and m, only 12 ways of i between 0 and 59 satisfies ways interpretation (for each clock)
C: search earliest clock ≦ disaster time ≦latest clock Time span Suppose Clock Time 1 Time 2 Time 3 … Time 72 Clock 1 Clock 2 - … Clockn Clock 1 Clock 2 … Clockn Time 1 + 12: 00(if minus) Suppose Time 3 … Time 72 max min. . . min
C: time span table earliest clock ≦ disaster time ≦latest clock Time span Shortest … Select Minimum Clock Time 1 Time 2 Time 3 Time 72 Clock 1 Span 1, 2 Span 1, 3 Span 1, 72 Clock 2 Span 2, 1 Span 2, 2 Span 2, 3 Span 2, 72 … Clockn Spann, 72 Minimum value of time span table indicates the answer.
Problem D: Digits on the floor Correct team Submit 9 20 • Recognize numbers with line segments.
D: How to recognize Figure [1] [2] [3] 4 4 0 1 2 0 5 6 0 4 6 1 3 5 1 5 6 0 • [1] Number of lines • [2] Number of points • [3] Number of points on mid-Line 5 6 1 3 4 0 5 6 2 4 5 1
D: How to distinguish 2 and 5 a a b b Cross product of vector a and b a×b < 0 a×b > 0
D: Judge Data
D: Judge Data
D: Judge Data
D: Judge Data
D: Judge Data
D: Judge Data
E: Spherical Mirrors Correct team Submit 10 12 • Ray tracing • Easy problem in the geometry domain • Answer the last mirrored point
E: reflection
E: reflection cosθ
E: Intersection of Line and Sphere Line l: Sphere u: Intersection: This quadratic equation for t can be solved easily.
E: select appropriate t Minimal Positive t means the reflection point. ○ × Minus Greater ×
Problem F: Traveling Cube Correct team Submit 14 18 • Colored cube rolls on square tiles. • On colored tiles, the top face of cube should be colored the same. • Cube must visit the colored tile in the specified order.
F: Cube on a Square Tessellation # 1 3 5 6 4 2
F: Search Space • State of dice: top color 6, north color 4 • Size of tiles: w*d • Number of targets: 6 Node of the graph: 6 * 4 * w * d * 6 Search the graph with Dijkstra
G: Search of Concatenated String Correct team Submit 9 55 • Search concatenation of all patterns. aa b ccc Concatenation of all patterns aabccc aacccb baaccc bcccaab cccbaa aabccczbaacccbaazaabbcccaa
G: Wrong Answer (naive algorithm) Concatenated pattern aabccc aacccb baaccc bcccaab cccbaa text aabccczbaacccbaazaabbcccaa aabccc aacccb baaccc bcccaa cccbaa
G: Wrong Answer Complexity: n! × Text length 12! × 5000 = 2395008000000 Too Large to Solve Example of judge data: text patterns aaaaaaaaaaaaaaa…a a, a, a, b
G: Acceptable Algorithm P 1 P 2 P 1, P 3 P 2, P 3 Text P 1 P 2 P 3 For each point of target string, remember the matched pattern sequence.
G: To express matched patterns For n patterns, n bits are needed to express which patterns are matched. P 1 P 2 P 12 0000001 ・・・ 111111 patterns To express these bits pattern simultaneously, 4096 bits needed. 100100000000000……………………………………… 0 O(2 n×Text length) of memory needed.
H: Top Spinning Correct team Submit 0 1 • Find the center of a top to make it spin well. • Determine whether the center of a top is on the part of the cardboard cut out.
H. Top Spinning
Approximation of a Cicular Segment by a Series of Line Segments As the accuracy requirement is not so severe, it might be a good idea to approximate circular segments by a series of line segments
Computing the Barycenter Triangulation The area can be partitioned into triangles. The center of mass can be computed based on areas and mass centers of these triangles.
Computing the Barycenter Positive and Negative Integration Another possible way is to intepret the path as a graph and compute the integral of the graph. When a segment goes leftwords, the area can be considered negative.
Telling Whether the Barycenter is Inside the Area or Not Summing up angles of the barycenter and two ends of segments is 2π iff it is inside. But approximating an arc with a single line segment may lead to a wrong decision!
Telling Whether the Barycenter is Inside the Area or Not Whether the number of crosses with a ray starting from the barycenter is even/odd can tell outside/inside. Here too, approximating an arc with a line seg. is dangerous!
Telling Whether the Barycenter is Inside the Area or Not Direction of the path segment closest to the barycenter can tell whether or not it is inside the area.
Judge Data
Judge Data
Judge Data
I: Common Polynomial Correct team Submit To calculate GCM, the previous divisor be the dividend, the previous remainder be the divisor. When remainder is 0, then the divisor is GCM. dividend a b e divisor remainder ÷ b … c ÷ c … ÷ f … d … 0 GCM 2 2
I: Common Polynomial x 2 +10 x+25 …[1] x 2 +6 x+5 …[2] Subtract less degree polynomial from greater degree polynomial after making highest degree’s coefficients to the same. [1]-[2] [2]-[3]×x x 2 +10 x+25 x 2 +6 x+5 4 x+20 - [3]-[4] Common Polynomial x 2 +6 x+5 x 2 +5 x x+5 - x+5 0 x+5 …[4] …[3]
J: Zigzag Correct team Submit P 1 P 2 I 1 I 2 0 00 Generate all the lines which pass through two or more points. Find all the intersections of lines.
J: Zigzag Generate all the line segments between each pair of (Pi, Pj), (Pi, Ij), (Ii, Ij) which pass at least two points. P 1 P 2 I 1 × I 2 For each points Pi, suppose it as a start point, and search with Dijkstra.






















































