#B. [CZOJ 一周一测 R9 B] Sequence Modify

    传统题 200ms 32MiB

[CZOJ 一周一测 R9 B] Sequence Modify

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

定义一个序列的魅力值为这个序列的 mexmex 减这个序列的 minmin(可以为负)。

你有一个长度为 nn 的序列,初始元素 aia_i 均为 00

你可以进行若干次操作:

  • 选出一个子序列 alara_l\sim a_r, 把里面的每个元素增加这个子序列的魅力值

最终能否把这个序列改为 {bi}\{b_i\}

输入格式

第一行输入一个整数 TT,表示数据组数。

对于每组数据,第一行输入一个整数 nn

接下来一行,输入 nn 个整数 bib_i.

输出格式

TT 行,每行输出 YesNo 表示答案。

5
2
0 3
4
3 4 2 5
6
6 3 5 3 4 6
7
2 4 3 6 5 7 8
12
3 6 5 9 4 7 8 2 4 6 3 5
Yes
No
Yes
No
Yes

提示

样例解释

一开始这个序列为 0 0

先选择 222\sim 2 的区间,mex=1,min=0mex=1, min=0222\sim 2 的区间的所有数增加 110 0\to0 1

接下来选择 121\sim 2 的区间,mex=2,min=0mex=2, min=0121\sim 2 的区间的所有数增加 220 1\to2 3

最后选择 111\sim 1 的区间,mex=0,min=2mex=0, min=2111\sim 1 的区间的所有数增加 2-22 3\to0 3

$1\le T\le 10,1\le n\le 2\times10^3,0\le b_i\le 10^{18}$

Subtask nn bib_i 分值
00 无特殊限制 bi1b_i\le 1 22
11 n5n\le 5 bi10b_i\le 10 88
22 n30n\le 30 无特殊限制 1010
33 n100n\le 100 1515
44 无特殊限制 bi10b_i\le 10 2020
55 无特殊限制 4545

[CZR-009] CZOJ Weekly Exercise Round 9

未参加
状态
已结束
规则
IOI
题目
6
开始于
2024-4-4 17:00
结束于
2024-4-4 22:30
持续时间
5.5 小时
主持人
参赛人数
20