Codeforces Beta Round #44 (Div. 2)
Published:
I participated in the above-mentioned contest by the virtual contest system of CF.
From today, I’m going to participate in virtual contests often.
A. Triangular numbers
Given an integer n, find x such that x(x+1)/2 = n.
If there’s no solution, print “Impossible”.
Just do it.
But I used the binary search method.
B. Coins
Given the relations of weight between three coins A, B, and C, arrange these coins in ascending order.
If that relations are contradictory to each other, print “Impossible”.
Just do it.
C. Crossword
Given six strings, create a crossword puzzle made of those in the form of a rectangular “eight” or infinity sign.
If you can’t, print “Impossible”.
Crap.
Sure, I don’t like constructive algorithms.
But, besides it, this problem disgusts me because it doesn’t define “the lexicographically minimum” strictly.
D. Safe
Given an integer n(<=35) which represents the length of the password, an integer m(<=10) which represents the number of attempts of entering a password, each passwords entered and each system responses(how many positions stand the right numbers), then answer how many possible passwords that don’t contradict the m system responses are left.
Meet-in-the-middle attack!! Just do MITM.
BTW, in Japanese, MITM is called “half of all listing”.
E. Cannon
Given the n angles at which the n cannon balls will be fired, and the m positions of the walls, for every ball, answer the coordinates of its landing point.
Typical Geometry.
I didn’t have enough time to write the code of this problem, but the solution is simple.
- For each wall, calculate the range of angle at which a ball will hit it.
- Calculate “which angle at that a ball will hit which wall”.
- Calculate its landing point for each ball.