PSYCHOT - Psycho34 (easy)
In the prime factorization of a number N, there's two kinds of powers. Even powers, in red, are psychotic ones, and odd powers, in blue, are ordinary ones. We'll say N a Psycho number if the count of even powers is strictly greater than the count of odd powers, else an Ordinary number. For example, if N = 67500 with prime factorization 67500 = 22 x 33 x 54 . This number have 2 even powers and 1 odd power. Since 2>1, so the number 67500 is a Psycho Number.
Input
The first line of input contains an integer T, the number of test cases.
Each of the next T lines contains one integer N.
Output
For each test case, print if N is Psycho or Ordinary number.
Example
Input: 2 3 4 Output: Ordinary Number Psycho Number
Constraints
0 < T < 10^4 1 < N < 10^14
Time limit is ×2 my top speed with Python3 language, it could be not easy with slow languages. O(N^.5 / log(N)) should give TLE even with fast languages. You are awaited to submit something between O(N^0.33 / log(N)) and O(N^0.25 / log(N)). You can try before the quite similar "tutorial" problem : Psycho before. @speed addicts : my top C timing is 0.02s. (TL updated 2017-02-11 ; compiler changes)
hide comments
[Lakshman]:
2014-05-22 19:40:47
On the top now it is 0.05;)
|
|
[Lakshman]:
2014-05-15 07:16:09
@Mitch Schwartz Yes I have checked many hand made strong cases with my AC and the last submitted code.
|
|
Mitch Schwartz:
2014-05-15 06:19:17
@Lakshman, have you generated some random tests and compared output between your old AC and your new WA code? |
|
[Lakshman]:
2014-05-15 05:33:42
@Francky Can you please have a look on my last submission, I have used trial division but getting WA.
|
|
wisfaq:
2014-05-14 10:43:34
Personally I think that moving a 7 month old classical problem to tutorial because a EB member has made a more challenging version smells like "detournement du pouvoir"
|
|
[Lakshman]:
2014-05-14 08:43:52
Let me check with my python code.
|
|
[Lakshman]:
2014-05-14 08:36:19
@Francky good constraints and Time limit. definitely not an easy even with fast language, even O(N^0.3) is getting TLE with fast language. we need O(N^0.25) for AC. Good for classical section.
|
Added by: | Francky |
Date: | 2014-05-14 |
Time limit: | 1.200s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | PSYCHON |