QOJ.ac

QOJ

Limite de temps : 4 s Limite de mémoire : 1024 MB Points totaux : 100

#1779. 招聘帮手

Statistiques

一家大型软件开发公司有 $n$ 名开发人员。每位在职程序员的生产力通过两个关键绩效指标进行严格衡量:每小时编写的代码行数和每小时修复的 Bug 数量。

当需要完成一个项目时,负责该项目的经理会被分配 $t$ 个工时的程序员时间预算。经理随后可以为项目安排不同的程序员,总工时不超过 $t$。例如,如果有三名程序员,经理可以分配非负实数 $t_1, t_2, t_3$ 作为他们各自的工作时长,只要满足 $t_1 + t_2 + t_3 \le t$。如果这三名程序员每小时分别编写 $l_1, l_2, l_3$ 行代码,那么项目总共将编写 $t_1 \cdot l_1 + t_2 \cdot l_2 + t_3 \cdot l_3$ 行代码。同样,如果他们每小时分别修复 $b_1, b_2, b_3$ 个 Bug,总共将修复 $t_1 \cdot b_1 + t_2 \cdot b_2 + t_3 \cdot b_3$ 个 Bug。

由于经济形势不确定,公司实行冻结招聘,这意味着不会有新程序员加入公司。然而,在特定条件下,如果无法在内部高效完成项目,经理被允许通过将项目外包给外部顾问来引入外部帮助。具体而言,如果顾问在 $t$ 小时内编写了 $\ell$ 行代码并修复了 $f$ 个 Bug,且存在一种现有程序员的分配方式,能在最多 $t$ 小时内编写至少 $\ell$ 行代码并修复至少 $f$ 个 Bug,那么经理就不被允许聘请该顾问(无论这些现有程序员是否真的有时间从事该项目,或者他们是否已经忙于其他项目)。

虽然没有新程序员加入,但员工有时会决定离职。给定一份按时间顺序排列的事件列表(包括聘请顾问的请求和员工离职),请找出哪些请求会被批准。

输入格式

输入的第一行包含一个整数 $n$ ($0 \le n \le 2 \cdot 10^5$),即公司(初始时)的程序员人数。程序员编号为 $1$ 到 $n$。 接下来 $n$ 行,第 $i$ 行包含两个整数 $\ell_i$ 和 $f_i$ ($1 \le \ell_i, f_i \le 10^8$),分别表示程序员 $i$ 每小时编写的代码行数和修复的 Bug 数量。 接下来一行包含一个整数 $e$ ($1 \le e \le 10^5$),即事件数量。随后是 $e$ 行,按时间顺序描述事件。每个事件为以下两种形式之一:

  • “c $t$ $\ell$ $f$”,其中 $t, \ell, f$ 为三个整数 ($1 \le t \le 100, 1 \le \ell, f \le 10^8$):请求聘请一名顾问完成一个 $t$ 小时的项目,该顾问在 $t$ 小时内编写 $\ell$ 行代码并修复 $f$ 个 Bug。
  • “q $i$”,其中 $i$ 为一个整数 ($1 \le i \le n$):程序员 $i$ 从公司离职。

你可以假设没有程序员会离职超过一次。

输出格式

对于每个聘请顾问的请求,如果请求被批准,输出 “yes”,否则输出 “no”。

样例

样例输入 1

4
200 100
100 200
100 100
200 200
5
c 10 2000 2000
c 5 750 750
q 4
c 3 600 600
c 10 1500 1500

样例输出 1

no
no
yes
no

样例输入 2

8
400 300
300 200
300 400
200 300
500 500
100 500
100 100
500 100
12
c 4 1611 1601
c 3 602 601
c 2 399 795
c 1 395 206
q 7
q 6
q 5
q 4
c 4 1611 1601
c 3 602 601
c 2 399 795
c 1 395 206

样例输出 2

no
no
no
no
yes
no
no
no

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
EditorialOpen Official EditorialQingyu- Download

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.