QOJ.ac

QOJ

Límite de tiempo: 1.0 s Límite de memoria: 1024 MB Puntuación total: 100 Hackeable ✓

#14719. 種樹

Estadísticas

小 L 喜歡種樹。

小 L 在院子的左右兩側各種了 $d$ 棵樹。在左側,第 $i$ 棵樹在第一天的高度為 $x_i$ 公尺,且每天長高 $f_i$ 公尺。在右側,第 $i$ 棵樹在第一天的高度為 $y_i$,且每天長高 $g_i$ 公尺。

然而,小 L 不希望樹長得太高。為了保持整齊,對於編號為 $i$ 的樹,如果其高度達到或超過 $m_i$,他就會將其修剪掉 $m_i$ 公尺,直到其高度小於 $m_i$ 為止。

現在,小 L 想知道,對於編號為 $i$ 的樹,在種下後的前 $n_i$ 天內,每天進行修剪之後,有多少天左側的樹比右側的樹矮。

注意:第一天也會進行修剪。

輸入格式

每個測試檔案中只有一組測試資料。

第一行包含一個正整數 $d$($1 \le d \le 10^4$),表示院子每側樹的數量。

接下來的 $d$ 行,每行包含六個正整數 $f_i, x_i, g_i, y_i, n_i, m_i$($1 \le f_i, x_i, g_i, y_i, n_i, m_i \le 10^6$),其意義如上所述。

輸出格式

輸出 $d$ 行,每行包含一個非負整數,表示對於編號為 $i$ 的樹,在 $n_i$ 天內左側的樹比右側的樹矮的天數。

範例

範例輸入 1

1
7 4 6 3 3 4

範例輸出 1

2

說明

對於第一個範例,我們統計前 $3$ 天:

第 $1$ 天:道路左側樹的初始高度為 $4$ 公尺,右側的樹為 $3$ 公尺。左側的樹達到了 $4$ 公尺的上限,因此被修剪。修剪後,左側的樹為 $0$ 公尺,右側的樹為 $3$ 公尺;左側比右側低。

第 $2$ 天:左側的樹為 $7$ 公尺,右側的樹為 $9$ 公尺。兩者皆超過 $4$ 公尺,因此都被修剪。修剪後,左側的樹為 $3$ 公尺,右側的樹為 $1$ 公尺;左側不比右側低。

第 $3$ 天:左側的樹為 $10$ 公尺,右側的樹為 $7$ 公尺。兩者皆超過 $4$ 公尺,因此都被修剪。修剪後,左側的樹為 $2$ 公尺,右側的樹為 $3$ 公尺;左側比右側低。

因此,輸出為 $2$。

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#943EditorialOpenNew Editorial for Problem #14719KiharaToumaView

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.