#P10374. [AHOI2024 初中组 / 科大国创杯初中组 2024] 操作

    ID: 11772 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 5 上传者: 标签>模拟线段树树状数组2024安徽O2优化差分

[AHOI2024 初中组 / 科大国创杯初中组 2024] 操作

Background

The testdata for this problem is not official.

Official testdata (that can be uploaded here) is being collected.

Official testdata (that cannot be uploaded here): https://www.luogu.com.cn/training/499869

Unofficial testdata download: https://scg3.piaoztsdy.cn/training/69bce235a7cf509104565c83

Problem Description

Xiaokeke has an array {an}\{a_n\} (initially {an}={0,0,,0}\{a_n\}=\{0,0,\ldots,0\}) and mm machines arranged from left to right. For the ii-th machine, its type is oi{1,2}o_i \in \{1,2\} and its parameters are xi,yix_i,y_i. The operation performed by the ii-th machine is as follows:

  • If oi=1o_i=1, add yiy_i to a(xi)a_{(x_i)}. It is guaranteed that 1xin1 \le x_i \le n and 1yi1041 \le y_i \le 10^4.
  • If oi=2o_i=2, perform the operations of machines xiyix_i \sim y_i once each. It is guaranteed that 1xiyii11 \le x_i \le y_i \le i-1.
  • In particular, it is guaranteed that o1=1o_1=1.

Now Xiaokeke executes the operations of machines c1,c2,,ckc_1,c_2,\ldots,c_k once each in order. She wants to know what the final array {an}\{a_n\} is.

Since the values in the array may be very large, you only need to output the remainder of each element modulo 1000710007.

Input Format

The first line contains three positive integers n,m,kn,m,k.

The next line contains kk positive integers {ck}\{c_k\}.

The next mm lines each contain three positive integers oi,xi,yio_i,x_i,y_i on the ii-th line.

Output Format

Output one line with nn non-negative integers, representing the remainder of each element in {an}\{a_n\} modulo 1000710007.

2 3 3
1 2 3
1 1 2
2 1 1
2 1 2
8 0

Hint

Sample 1 Explanation

First, execute the operation of machine 11, which adds 22 to a1a_1.

Then execute the operation of machine 22. It operates machine 11, adding 22 to a1a_1.

Then execute the operation of machine 33. It first operates machine 11, adding 22 to a1a_1; then it operates machine 22, and machine 22 operates machine 11 again, adding 22 to a1a_1.

In summary, the final array is {8,0}\{8,0\}.

Constraints

For 10%10\% of the testdata, n,m,k10n,m,k \le 10.

For 30%30\% of the testdata, n,m,k1000n,m,k \le 1000.

For another 20%20\% of the testdata, n=1n=1.

For another 20%20\% of the testdata, k=1k=1.

For 100%100\% of the testdata, 1n,m,k2×1051 \le n,m,k \le 2 \times 10^5, 1cim1 \le c_i \le m, oi{1,2}o_i \in \{1,2\}, and o1=1o_1=1. In addition, for the ii-th machine, it is guaranteed that:

  • If oi=1o_i=1, then 1xin1 \le x_i \le n and 1yi1041 \le y_i \le 10^4.
  • If oi=2o_i=2, then 1xiyii11 \le x_i \le y_i \le i-1.

Translated by ChatGPT 5