#P9783. [ROIR 2020] 平方 (Day1)

    ID: 11074 远端评测题 1000ms 128MiB 尝试: 0 已通过: 0 显示难度普及− 上传者: 标签>2020Special JudgeROIR(俄罗斯)

[ROIR 2020] 平方 (Day1)

Problem Description

Translated from ROIR 2020 Day1 T1. Разность квадратов, translator ShineEternal

You are involved in developing a module for a symbolic computation system. It will be used to solve a special type of Diophantine equation, described as follows:

Given a non-negative integer nn, the module under development needs to find two positive integers xx and yy such that x2−y2=nx^2-y^2=n, where x,yx,y do not exceed 262−12^{62}-1.

You need to write a program that, for a given non-negative integer nn, finds two natural numbers xx and yy such that both of them do not exceed 262−12^{62}-1 and their difference of squares is nn.

Input Format

One line with one integer nn.

Output Format

If such x,yx,y exist, print two lines. The first line should be the single string Yes. The second line should print any one pair x,yx,y.

If no such pair exists, output No.

3
Yes
2 1
2
No

Hint

For 100%100\% of the testdata, 0≤n≤2600\le n\le 2^{60}.

Constraints

Task ID nn Score
11 0≤n≤2100 \leq n \leq 2^{10} 1010
22 0≤n≤2200 \leq n \leq 2^{20} 2020
33 0≤n≤2300 \leq n \leq 2^{30} 3030
44 0≤n≤2600 \leq n \leq 2^{60} 4040

Translated by ChatGPT 5