QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 1024 MB Points totaux : 100 Hackable ✓

#18453. 直方圖序列 4

Statistiques

你曾經擁有一個由 $N$ 個軸對齊矩形組成的直方圖,它們共享同一個基線:從左邊數起的第 $i$ 個矩形寬度為 $1$,高度為整數 $H_i$。

遺憾的是,你弄丟了你的直方圖!此外,你甚至忘記了直方圖的樣子——即直方圖中各個矩形的高度。你所記得的是直方圖內軸對齊矩形的最大面積 $A$,以及對於每個 $H_i$ 都滿足 $L \le H_i \le R$ 的事實。

你的目標是透過找到任何滿足你所記得的所有條件的直方圖來恢復它。由於你的記憶可能不完美,可能不存在滿足這些條件的直方圖。

輸入格式

輸入的第一行包含四個以空格分隔的整數 $N, A, L, R$。

輸出格式

如果不存在滿足條件的直方圖,請輸出 NO

否則,請在第一行輸出 YES。在第二行,輸出 $N$ 個整數,其中第 $i$ 個值為第 $i$ 個矩形的高度 $H_i$。如果有多組答案,輸出其中任意一組即可。

資料範圍

  • $1 \le N \le 500\,000$
  • $0 \le A \le 10^{18}$
  • $0 \le L \le R \le 10^{18}$

範例

範例輸入 1

6 25 2 10

範例輸出 1

YES
3 7 6 8 5 5

範例輸入 2

1 0 0 1000000000000000000

範例輸出 2

YES
0

範例輸入 3

1 8213912883 0 28318

範例輸出 3

NO

說明

下圖展示了一個高度為 $3, 7, 6, 8, 5, 5$ 的直方圖。該直方圖內的最大矩形面積為 $25$。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.