PRINT - Prime Intervals
In this problem you have to print all primes from given interval.
Input
t - the number of test cases, then t lines follows. [t <= 150]
On each line are written two integers L and U separated by a blank. L - lower bound of interval,
U - upper bound of interval. [2 <= L < U <= 2147483647] [U-L <= 1000000].
Output
For each test case output must contain all primes from interval [L; U] in increasing order.
Example
Input:
2 2 10 3 7
Output:
2 3 5 7 3 5 7
hide comments
cqui:
2015-10-18 16:23:57
For info, I just passed using cout and cin with time bellow .5s with C++ (g++5.1). |
|
Sriharshaa Sammeta:
2015-08-31 18:41:42
Crazy -> I too just changed my solution of PRIME1 with cout and cin to printf and scanf. It passed. Insane !!!! |
|
golden_ratio:
2015-08-20 13:20:47
The time limit is too strict, my solution with a right approach was just not working because I was using cin and cout (even with sync_with_stdio(false)). It got accepted instantly once I used scanf and printf.
|
|
ArunAr:
2015-06-17 11:49:03
Bit wise Optimized Segmented Sieve :) Ac |
|
Dushyant Singh:
2015-04-07 23:18:13
@Asheesh Pathak: You can click on 'Ranking' on top right corner of this question or go here
|
|
Asheesh Pathak:
2015-04-07 22:36:29
Mine runs in 0.59s. How can i see the best solutions for this problem? |
|
Wik146:
2015-03-24 20:55:14
I keep getting TLE for this - even outputting primes to stdout for a 1,000,000 range takes 2 secs on my computer...
|
|
Petar Bosnjak:
2015-03-17 22:06:26
Do we need to implement linear time sieve for this problem?
|
|
Madhav:
2015-02-11 19:18:22
very good question indeed!! |
|
cegprakash:
2015-01-02 21:30:10
PRIME1 solution got AC here too o.O
|
Added by: | Roman Sol |
Date: | 2005-03-28 |
Time limit: | 1.223s |
Source limit: | 15000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ERL JS-RHINO NODEJS PERL6 VB.NET |
Resource: | ZCon |