TDKPRIME - Finding the Kth Prime
The problem statement is really simple. There are some queries. You are to give the answers.
An integer stating the number of queries Q(equal to 50000), and Q lines follow, each containing one integer K between 1 and 5000000 inclusive.
Q lines with the answer of each query: the Kth prime number.
Input: 7 1 10 100 1000 10000 100000 1000000 Output: 2 29 541 7919 104729 1299709 15485863
getting a runtime error
Apply sieve till 87000008
precalculate all and submit 0.04 sec thats it
In Java, I had to use Fast IO, and bitwise sieve+bitset to get AC.
Took 0.76 sec using bitwise_seive.How to improve?
used bitwise sieve
@ayushgupta1997 how you got the max value
Simple Problem ,attempted after 1 year AC in one go :)
Is there some problem with the test cases, i checked/compared/double-checked the prime numbers generated by my sieve for first 5million primes, with 5million primes from https://primes.utm.edu/lists/small/millions/, they check out all of them are correct. But the test cases is giving me WA.
took 0.6 s...how to improve upon time
|Added by:||Alfonso² Peterssen|
|Cluster:||Cube (Intel G860)|
|Languages:||All except: ASM32 ASM64 BF CLPS LISP sbcl LISP clisp ERL HASK ICON ICK JS-RHINO LUA NEM NICE OBJC OCAML PHP PIKE PRLG-swi SCALA SCM qobi SCM guile ST SQLITE TCL WHITESPACE|
|Resource:||Thanks to TDuke|