Although there are problems in the methods of solving the problem in the following part ...
But every time a resubmit is a meaningful patch.
I can see how many problems exist in the course of my problem ...
Now think, similar to the variable is not open int64, the procedure function forget to open int64. And there's a lot of problems in the middle.
C. idempotent functions
Some time ago Leonid have known About idempotent functions. idempotent function defined on a set {1, 2, ..., n } is such function , that for any the formula G ( g ( x ) = g ( x ) holds.
Let ' s denote as F ( K ) ( x ) the function F applied K times to the Value x . More Formally, F (1) ( x ) = F ( X ), F ( K ) ( x ) = F ( F ( K -1) ( x )) for each K > 1.
You are given some function. Your task is to find minimum positive integer k such this functionf(k) (x) Is idempotent.
Input
The first line of the input there are a single integer n (1≤ n ≤200)-the size of Func tion f domain.
In the second line follow f(1), F(2), ..., f(n) (1≤ F( C22>i) ≤ n for each 1≤ i ≤ n), the values of a function.
Just start the deal. I just started ignoring the data range, using a multiplier ... And then derive a series of bizarre questions.
First consider the existence of the ring in the data, then the answer in order to meet the needs of these numbers need to meet the size of all the rings divisible
And then for the other number, another consideration
Just started ignoring the data range, with two points ... And then finally found that seems to be not satisfied with the monotony of ...
Just started to think that as long as the absence of the ring must be a little closer to a certain direction
But the discovery forgot to consider the situation
So in fact, from small to large enumeration of the answer can be ...
Finally found that the whole process of revision is nothing more than two stages:
1) Change O (logn) multiplier to O (n) simulation
2) Change O (logn) 's binary answer to an O (N) enumeration answer
And then it's over ...
Can no longer despise the data range.
04./may
Codeforces 542C-a long and arduous process of solving problems