#P9407. [POI 2020/2021 R3] 素数和 / Suma liczb pierwszych

    ID: 10509 远端评测题 5000ms 256MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>2020POI(波兰)Special Judge素数判断,质数,筛法双指针 two-pointer根号分治

[POI 2020/2021 R3] 素数和 / Suma liczb pierwszych

Background

Translated from XXVIII Olimpiada Informatyczna - Stage III Suma liczb pierwszych.

d2t3。

Problem Description

You are given a number nn. Find l,rl, r such that the sum of all prime numbers in the interval [l,r][l, r] equals nn.

If there are multiple solutions, any one is acceptable. If there is no solution, output NIE.

Input Format

One line containing one positive integer nn.

Output Format

If there is a solution, output one line with two positive integers l,rl, r, your answer.

If there is no solution, output NIE.

15

3 7

9992

4993 4999

100000000

NIE

1000000007

1000000007 1000000007

99999999996

295693 1693067

Hint

For all testdata, 1n10111\leq n\leq 10^{11}.

Constraints

Subtask ID Additional Constraints Score
1 n10000n\leq 10000 15
2 n108n\leq 10^8 20
3 n2×109n\leq 2\times 10^9 40
4 25

Translated by ChatGPT 5