QOJ.ac

QOJ

実行時間制限: 1.0 s メモリ制限: 1024 MB 満点: 100 ハック可能 ✓

#14719. 種樹

統計

小 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.