Submit | All submissions | Best solutions | Back to list |
TDKPRIME - Finding the Kth Prime |
The problem statement is really simple. There are some queries. You are to give the answers.
Input
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.
Output
Q lines with the answer of each query: the Kth prime number.
Example
Input: 7 1 10 100 1000 10000 100000 1000000 Output: 2 29 541 7919 104729 1299709 15485863
Added by: | Alfonso² Peterssen |
Date: | 2010-04-06 |
Time limit: | 1.240s |
Source limit: | 10000B |
Memory limit: | 1536MB |
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 guile SCM qobi ST SQLITE TCL WHITESPACE |
Resource: | Thanks to TDuke |
hide comments
|
|||||||||||
2018-01-14 07:29:58
@ayushgupta1997 how you got the max value |
|||||||||||
2017-12-09 11:53:04
Simple Problem ,attempted after 1 year AC in one go :) Hint : Sieve precomputation, declare array global with MAX=87000008 |
|||||||||||
2017-10-06 00:01:57 Sushant Moon
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. My submission ID is 20301637 Last edit: 2017-10-06 00:48:58 |
|||||||||||
2017-08-28 13:20:24
took 0.6 s...how to improve upon time |
|||||||||||
2017-01-25 05:28:13
Use Segmented Sieve...Took only 3.4MB space But how to make it time efficient..It took 0.67 sec Last edit: 2017-01-25 05:28:55 |
|||||||||||
2017-01-15 19:01:58
how can the top solution be 3.4M and 0.04 sec!!!! |
|||||||||||
2016-12-22 23:04:16
also , how is the memory use just 3.6 MB for best AC solution as per time limit.. sieve+an array till required takes 22MB in my case |
|||||||||||
2016-12-22 23:02:54
how are people getting 0.04 seconds while my nloglogn sieve of eratosthenes, several loop counter modifications alongwith scanf and printf got 0.56? |
|||||||||||
2016-07-08 11:44:04
do it just for bitwise seive. cool problem bitwise seive - > 0.45 sec linear seive -> 0.75 sec Last edit: 2016-07-08 11:59:28 |
|||||||||||
2016-06-15 20:07:19
@Alfonso2 Peterssen Last submitted solution is working perfectly on my machine. Can you please tell me why am I getting WA? |