QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 128 MB Total points: 100
統計

珂朵莉给了你一个序列,支持单点修改,或者询问满足区间 or 和大于等于一个数的区间的最短可能长度,无解输出 $-1$。

输入格式

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

接下来一行 $n$ 个整数,表示这个序列 $a$。

接下来 $m$ 行,形如:

  • $1\ i\ x$ 表示将 $a_i$ 修改为 $x$。
  • $2\ k$ 表示询问最短的一个长度,满足存在一个该长度的区间,其 or 和 $\geq k$。

输出格式

对所有 $2$ 操作,输出一行,包含一个整数,表示答案,无解输出 $-1$。

样例数据

样例输入

2 3
0 2 
2 3
1 1 1
2 3

样例输出

-1
2

提示

Idea:kczno1,

Solution:kczno1( $O( m\sqrt n\log a )$ solution ),liu_cheng_ao($O( m\log^2 n\log^2 a$ ) solution ),142857cs($O( m\log n\log^2 a$ ) solution )

Code:kczno1( $O( m\sqrt n\log a )$ code ),liu_cheng_ao($O( m\log^2 n\log^2a$ ) code )

,Data:kczno1

对于 $100\%$ 的数据,$0\leq a_i,k\leq 2^{30}$,$1\leq n,m\leq 5\times 10^4$。

Discussions

About Discussions

The discussion section is only for posting: Editorials, General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues. Submitting multiple issues may cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.