Submission #9217588


Source Code Expand

Copy
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

X = int(read())

def make_prime(U):
    is_prime = np.zeros(U,np.bool)
    is_prime[2] = 1
    is_prime[3::2] = 1
    M = int(U**.5)+1
    for p in range(3,M,2):
        if is_prime[p]:
            is_prime[p*p::p+p] = 0
    return is_prime, is_prime.nonzero()[0]

_, primes = make_prime(10 ** 5 + 10000)

large = primes[primes >= X]
answer = large.min()
print(answer)

Submission Info

Submission Time
Task C - Next Prime
User maspy
Language Python (3.4.3)
Score 300
Code Size 528 Byte
Status AC
Exec Time 289 ms
Memory 21708 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 20
Set Name Test Cases
Sample 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt
All 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt, 01-small-01.txt, 01-small-02.txt, 01-small-03.txt, 01-small-04.txt, 01-small-05.txt, 02-large-01.txt, 02-large-02.txt, 02-large-03.txt, 02-large-04.txt, 02-large-05.txt, 03-len-21.txt, 03-len-33.txt, 03-len-35.txt, 03-len-43.txt, 03-len-51.txt, 03-len-71.txt, 04-max-01.txt
Case Name Status Exec Time Memory
00-sample-01.txt AC 289 ms 21708 KB
00-sample-02.txt AC 148 ms 12680 KB
00-sample-03.txt AC 148 ms 12636 KB
01-small-01.txt AC 147 ms 12636 KB
01-small-02.txt AC 146 ms 12636 KB
01-small-03.txt AC 148 ms 12636 KB
01-small-04.txt AC 148 ms 12636 KB
01-small-05.txt AC 147 ms 12636 KB
02-large-01.txt AC 149 ms 12636 KB
02-large-02.txt AC 147 ms 12552 KB
02-large-03.txt AC 147 ms 12636 KB
02-large-04.txt AC 147 ms 12552 KB
02-large-05.txt AC 147 ms 12380 KB
03-len-21.txt AC 147 ms 12636 KB
03-len-33.txt AC 148 ms 12636 KB
03-len-35.txt AC 148 ms 12636 KB
03-len-43.txt AC 148 ms 12636 KB
03-len-51.txt AC 149 ms 12636 KB
03-len-71.txt AC 148 ms 12636 KB
04-max-01.txt AC 148 ms 12636 KB