QOJ.ac

QOJ

Time Limit: 4 s Memory Limit: 64 MB Total points: 100

#7450. tmpq

统计

给定三个长为 $n$ 的数组 $a,b,c$, 满足 $1\le a_i,b_i,c_i\le n$ 且为整数。

你需要进行 $m$ 次操作,每次操作为:

1 k x:代表将 $a$ 序列的第 $k$ 个位置改为 $x$,即 $a_k := x$。

2 r:代表查询有多少个三元组 $(i,j,k)$, 满足 $1\le i < j < k\le r$, 且 $b_{a_i}=a_j=c_{a_k}$。

输入格式

第一行两个数 $n,m$。

第二行 $n$ 个数,按顺序表示序列 $a$ 中的元素。

第三行 $n$ 个数,按顺序表示序列 $b$ 中的元素。

第四行 $n$ 个数,按顺序表示序列 $c$ 中的元素。

之后 $m$ 行,每行形如 1 k x2 r,意义如上述。

输出格式

对每个 $2$ 操作,输出一行一个数表示答案。

样例数据

样例输入

5 4
1 2 3 4 5
2 3 4 5 1
5 1 2 3 4
2 5
1 2 3
2 4
2 5

样例输出

3
0
2

子任务

Idea:Forever_Pursuit&nzhtl1477&w33z8kqrqk8zzzx33,

Solution:nzhtl1477&w33z8kqrqk8zzzx33,

Code:w33z8kqrqk8zzzx33,

Data:w33z8kqrqk8zzzx33&nzhtl1477

对于 $100\%$ 的数据,满足 $1\le n\le 2\times 10^5$,$1\le m\le 5 \times 10^4$,$1\le a_i,b_i,c_i,x,k,r\le n$。

对于第一个操作,满足条件的三元组为:

  • $ i=1 $ , $ j=2 $ , $ k=3 $
  • $ i=2 $ , $ j=3 $ , $ k=4 $
  • $ i=3 $ , $ j=4 $ , $ k=5 $

对于第三个操作,没有满足条件的三元组。

对于第四个操作,满足条件的三元组为:

  • $ i=2 $ , $ j=4 $ , $ k=5 $
  • $ i=3 $ , $ j=4 $ , $ k=5 $
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.