Daniel OIer trial race P2

Difficulty level: simple problem to solve with violence law.
Skills assessment: computational complexity, coding capability.
This question logic is simple, but also need to be flexible; does not involve complex algorithms, but need to understand the complexity of the calculations and to avoid falling into the trap; the code is relatively short, but there are certain skills. This problem can be investigated basic computational thinking and better coding capabilities.

\ ((1) \) logic

The maximum possible force, there appear \ (N {10} ^ { 5} \ =) in the case of the frog and frog is all one color, when force is \ ({N} ^ {2 } = { ^ {10} 10} <2} ^ {-1} {63 \) can be used to \ (64 \) bit long longindicates the type.

\ ((2) \) computational complexity.

When solving, first of all to be noted that the size of data, i.e., \ (. 1 <= N <= {10}. 5 ^ {} \) , which can not be described using the time complexity is greater than \ (O ({N} ^ {2} ) \) algorithm.

Beginners algorithm contest, if not noticed this limitation, it will fall into the trap of violence following simple method, the result is \ (TLE \) : Changing the color of a frog

Guess you like

Origin www.cnblogs.com/SuperTer/p/contest-25052-problem-2.html