All submissions for this problem are available.
Imagine a n-sided regular polygon. At each vertex of the polygon lies a particle 'x'. Now, in a hypothetical experiment, starting at time
= 0s, each particle 'x' travels on the sides of polygon in clockwise manner with a constant speed. Therefore, a square with vertices A,
B, C, D ( in clock-wise direction) , a particle 'x' starting at 'A' would move along side 'AB' and reach 'B', then travel along 'BC' and
reach 'C' and so on.
Each particle has same properties except that they may or may not start with the same constant speed. Thus, a particle with a
higher speed would ultimately collide into the particle in front of it when going in clockwise manner. Collision of two or more particles
at a given time instant results in a fusion, thus giving rise to a single particle with same properties except that its speed is the average
of the speeds of the colliding particles. The experiment stops at time = t, when a stability point is reached i.e. when there is no
chance of further fusion.
Now given the total sides, length of the side of the regular polygon and speeds of different particles, you have to find 't' i.e. the time
taken to reach to the stability point and the final speed of the particle(s).
- If the distance between two particles is less that 0.0000001 mts i.e. 1e-7 or 10 ^ -7, collision occurs.
- Particles follow the general kinematics rule( except for the collision rules stated above ).
- Assume there is no friction or air resistance.
- Assume that the time taken at edges and the time taken for fusion is negligible.
- All calculations are to be done in meters and seconds.
- Use maximum precision wherever possible.
1. Number of test cases = 'T' ( 1 <= T <= 500 ).
2. For each test case, first line contains number of sides in regular polygon = 'D' ( 3 <= D <= 50 ).
3. Next line contains length of a side = 'L' ( integer ) ( 5 <= L <= 10000 ) in meters.
4. Next input contains speed of all D particles ( in clockwise direction, each speed on new line ) = 'S' ( integer ) ( 5 <= S
<= 1000 ) in meters per second.
1. Each line of output contains total time 't' taken for the experiment to reach the stability point followed by a space and the final
speed of the particle(s). Give your answer up to 6 decimal places.
Input: 2 4 100 500 200 300 400 3 100 200 200 200 Output: 3.000000 350.000000 0.000000 200.000000
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, SQL, kotlin, PERL6, TEXT, CPP17, SCM chicken, PYP3, CLOJ, R, COB, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.