Simulation test 20,190,815

%%% soaring

The test was what the hell, ah, three questions did not think positive solution, but will not lie to cheat points, playing only violence to maintain this way of life had a god than a

T1 up against a table saw 2h, try a matrix, the number of combinations had no fruit tree called violence array, 2h20min, scoring 15pts

Then hit T2 violence (yes I have to give a positive solution orz), burst search + 20pts special sentence that somehow hung up 5pts, scoring 45pts

Then code T3 violence, but violence will not lead to a recursive explosion hit the stack, MLE 0

Total 15 + 45 + 0 = 60, rank ...... 5? ! ?

Really God (du) Qi (liu) is an exam

T1: number theory

(Very unfriendly title)

Seen from the observation (+ speculating playing table), a good few integer data range

So if we can quickly screen out all the great numbers, can be done O (1) answer questions

How sieve it, we begin the most well-known is the number 1, to consider expanding its use

Each enumerator a prime number p, a known good number x may be extended (P * x 0 , x * P . 1 ......), to obtain a candidate set S

Small to large scan each element S, while maintaining the value of k + 1 before the number of the divisor large, if the number of a divisor element k + 1 is smaller than the first value is discarded big

So we should enumerate how many prime factors to it, we try to find a number that contains only small prime factors are more likely to be a good number, after practice, p <= 293 enough to pass this problem

Of course, we can consider the idea of ​​a stable iteration to determine whether the screen several times have not changed End

Complexity of O (max (p) * n * logk * log (m))

To be continued (the cushions)

 

Guess you like

Origin www.cnblogs.com/mikufun-hzoi-cpp/p/11361558.html