当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6756:Finding a MEX

题目描述
Given an undirected graph G=(V,E). All vertices are numbered from 1 to N. And every vertex u has a value of $A_u$. Let $S_u$={$A_v$│(u,v)∈E}. Also, F(u) equals MEX(minimum excludant) value of $S_u$. A MEX value of a set is the smallest non-negative integer which doesn’t exist in the set.

There are two types of queries.

Type 1: 1 u x – Change $A_u$ to x (0≤x≤$10^9$).
Type 2: 2 u – Calculate the value of F(u).

For each query of type 2, you should answer the query.
输入解释
The first line of input contains a single integer T (1≤T≤10) denoting the number of test cases. Each test case begins with a single line containing two integers n (1≤n≤$10^5$), m (1≤m≤$10^5$) denoting the number of vertices and number of edges in the given graph.

The next line contains n integers and $i^{th}$ of them is a value of $A_i$ (0≤$A_i$≤$10^9$).

The next m lines contain edges of the graph. Every line contains two integers u, v meaning there exist an edge between vertex u and v.

The next line contains a single integer q (1≤q≤$10^5$) denoting the number of queries.

The next q lines contain queries described in the description.
输出解释
For each query of type 2, output the value of F(u) in a single line.
输入样例
1
5 4
0 1 2 0 1
1 2
1 3
2 4
2 5
5
2 2
1 2 2
2 2
1 3 1
2 1
输出样例
2
2
0
来自杭电HDUOJ的附加信息
Recommend liuyiding

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6756

最后修改于 2020-10-25T23:34:06+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
6000/3000MS(Java/Others) 524288/524288K(Java/Others)