Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
?
I got pretty similar result ~ 3.6s
I'm stuck on 58!
theDarkBright, I just ran your solution now (twice) and it ran for 4.7 secs. Maybe server load plays a role. I ran mine also, and it runs in 0.7 secs. So there is still room for improvement. I also don't think my implementation is the most optimal one.
lol wish I saw this before I started fixing mine, cause I had the same bug.. (java)
I'm glad you figured it out & liked it.
TDRS
Got it, and solved. Thanks a lot!
The description says:
4 = 2 * 2 is 2-prime since he has two prime factors (the prime 2 is not unique: 2 has multiplicity 2 since the prime 2 appears 2 times)
6 = 2 * 3 is 2-prime since he has two prime factors (2 and 3)
8 = 2 * 2 * 2 is 3-prime since 2 is prime and its multiplicity (= number of times it appears) is 3
12 = 2 * 2 * 3 is 3-prime since he has 2 prime factors (2 and 3 but 2 appears 2 times)
48 = 2 * 2 * 2 * 2 * 3 is 5-prime: 2 appears 4 times and 3 once
Note: 1 is not a prime factor because 1 is not a prime.
prime factors
, notunique prime factors
I don't get what a k-prime is, honestly. If it is 1-inclusive, isn't 6 a 3-prime, and isn't 8 a 2-prime? If it is not 1-inclusive, aren't both 4 and 8 1-primes?
4: prime factors -> (1,) 2
6: prime factors -> (1,) 2, 3
8: prime factors -> (1,) 2
What does
counted with multiplicity
mean?Did you finally debug it? Because I have the exact same issue with Python.
I pass all sample tests, though.
The above is my result.
This is the reference result. So far, I've mostly overshot by 2 points, and always at the first alien to hit. :/
EDIT: My bad. I didn't read the hit-sequence instruction properly.
Python: Unlike in JS version, generating all the test cases alone took 5.5-6.5 seconds, which leaves us only 6 seconds (in Python 2) or worse, just 4 seconds (in Python 3) to spare after accounting for reference solution. JS version, on the other hand, has 7-8 seconds.
Also, the input range is given. Any good competitive programming participant should be able to judge the required complexity based on the input range ;-)
You need a
O(n)
toO(log n)
solution ;-)This comment is hidden because it contains spoiler information about the solution
Loading more items...