logo AlgoBeat OnlineJudge
登录 注册

#215978. [TOPC 2024] In Search of the Lost Array

内存限制:512 MiB 时间限制:2000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

In a forgotten realm, a group of adventurers stumbles upon a set of mysterious scrolls hidden deep within an ancient library. These scrolls hold the secrets of a powerful numerical array that controls the magic of the realm. However, the scrolls have been damaged over time, and only fragments remain. Specifically, the adventurers discover a sequence of numbers representing the products of adjacent elements of an unknown array .

The original array consists of integers where for . The only information remaining on the scrolls is a sequence of integers , which are unordered products of adjacent elements from . In other words:

Your task is to help the adventurers reconstruct one possible original array . If there are multiple valid arrays that could result in the same sequence , you may output any of them.

输入格式

The first line contains a single integer , representing the length of the array . The second line contains space-separated integers , representing the products of adjacent elements in the array .

输出格式

If there is no such array , then print No on a line. Otherwise, print Yes on the first line. Then, output space-separated integers on the second line, where .

样例

样例输入 1

8
42 32 84 54 48 40 16

样例输出 1

Yes
5 8 4 21 2 8 6 9

样例输入 2

6
45 4 5 4 3

样例输出 2

Yes
3 1 4 1 5 9

样例输入 3

2
3246

样例输出 3

No

数据范围与提示

  • .
  • for
  • for