CF1252G Performance Review
题目描述
### 题意
一个公司有 n 个员工,每个员工有一个能力值 $a_i$, 每个 $a_i$ 都不一样。公司采取末位淘汰制,我们考虑 m 年,每年年底都会补充 $r_i$ 个新员工,每个新员工的能力值被表示为 $b_{i_j}$, 即第 $i$ 年新加入的第 $j$ 个员工的能力值。每年,能力值最靠后的 $r_i$ 个员工会被炒鱿鱼,取而代之的是新加入的这 $r_i$ 个员工。你是第 1 号员工,你的能力值是 $a_1$ 。
还有 $q$ 次操作,每次操作的描述形如 $(x_i,y_i,z_i)$, 表示把第 $x_i$ 年加入的第 $y_i$ 个员工的能力值改为 $z_i$。 现在对于每个操作输出 $0$ 或 $1$,表示如果进行完这个操作,$m$ 年之后你会不会被炒鱿鱼。注意,操作是永久性的。
输入格式
第一行三个正整数 $n,m,q$,$2\le n\le 10^5,\ \ 1\le m,q\le 10^5$。
之后的 $m$ 行,每行描述一年新加入的员工的信息。每行第一个整数是 $r_i$, 表示今年新加入的员工数量,之后的 $r_i$ 个正整数,描述员工能力值。之后的 $q$ 行,每行描述一个操作。
输出格式
共 $q$ 行,对于每个操作输出 $0$ 或 $1$。
说明/提示
Explanation for the sample input/output #1
Randall performance is represented by $ 50 $ . For the first scenario, the value of $ (B_1)_3 $ is updated to $ 300 $ , causes the following:
- Initially, the performance of the employees is $ [50, 40, 30, 20, 10] $ .
- At the end of the first year, $ 4 $ worst-performing employees are replaced by employees with performance $ [300, 100, 2, 1] $ . Therefore, the performance of the employees is $ [300, 100, 50, 2, 1] $ .
- At the end of the second year, the performance of the employees is $ [300, 100, 50, 4, 2] $ .
- At the end of the third year, the performance of the employees is $ [300, 100, 50, 7, 6] $ .
Therefore, Randall will still be in the company after $ 3 $ years.For the second scenario, the value of $ (B_2)_1 $ is updated to $ 400 $ , causes the following:
- Initially, the performance of the employees is $ [50, 40, 30, 20, 10] $ .
- At the end of the first year, the performance of the employees is $ [300, 100, 50, 2, 1] $ . Recall that the change in the first scenario is kept for this scenario as well.
- At the end of the second year, the performance of the employees is $ [400, 300, 100, 50, 2] $ .
- At the end of the third year, the performance of the employees is $ [400, 300, 100, 7, 6] $ .
Therefore, Randall will not be in the company after $ 3 $ years.