Logo
(追記) (追記ここまで)

26306번 - Balanced Seesaw Array 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 (추가 시간 없음) 1024 MB152413224.615%

문제

Bob likes to play seesaw. He thinks that it would be really funny if the seesaw is in a balanced state. It means that the seesaw is not tilted to the left and right. After playing the seesaw, Bob thinks about a problem related to the balanced seesaw.

Let $A = [a_1, a_2, \dots , a_m]$ denote an array of length $m$. Bob thinks that $[a_1, a_2, \dots , a_m]$ is a balanced seesaw array if there exists an integer $k$ between 1ドル$ to $m$ such that $\sum_{i=1}^{m}{(i-k)a_i} = 0$.

Bob gets an array $A = [a_1, a_2, \dots , a_n]$ as his birthday gift, and he is curious about whether some non-empty subarray is a balanced seesaw array. More formally, he is interested in whether $[a_l , a_{l+1}, \dots , a_r]$ is a balanced seesaw array for some specified pair $(l, r)$ where 1ドル ≤ l ≤ r ≤ n$. Bob also finds that the elements in its array will change by time, it will have the following two types of changes.

  1. $a_l , a_{l+1}, \dots , a_r$ are increased by $x$.
  2. $a_l , a_{l+1}, \dots , a_r$ are changed to $x$.

For convenience, Bob will give you the array $A = [a_1, a_2, \dots , a_n]$ first. Then, there are $q$ operations. Each operation will be one of the following three types.

  • 1ドル$ $l$ $r$ $x$: means that $a_l , a_{l+1}, \dots , a_r$ are increased by $x$.
  • 2ドル$ $l$ $r$ $x$: means that $a_l , a_{l+1}, \dots , a_r$ are changed to $x$.
  • 3ドル$ $l$ $r$: means that Bob is curious about whether the subarray $[a_l , a_{l+1}, \dots , a_r]$ is a balanced seesaw array. You should output “Yes” or “No” for each operation type 3.

입력

The first line of input contains two integers $n$ and $q$. $n$ is the length of the array, and $q$ is the number of operations. The second line contains $n$ integers $a_i$ to define the array. Each of the following $q$ lines is an operation described in the problem statement.

출력

Please output “Yes” or “No” to indicate whether $[a_l , a_{l+1}, \dots , a_r]$ is a balanced seesaw array for each type 3 operation.

제한

  • 1ドル ≤ n ≤ 100000$
  • 1ドル ≤ q ≤ 1200000$
  • $-1000 ≤ a_i ≤ 1000$
  • $-10000 ≤ x ≤ 10000$
  • For 1ドル ≤ i ≤ n,ドル you may assume that $|a_i | ≤ 1.5 × 10^9$ after any operation.
  • 1ドル ≤ l ≤ r ≤ n$

예제 입력 1

3 6
1 2 3
3 1 1
3 1 3
1 1 1 2
3 1 3
2 2 2 0
3 2 3

예제 출력 1

Yes
No
Yes
Yes

힌트

출처

ICPC > Regionals > Asia Pacific > Taiwan > Taiwan Online Programming Contest > TOPC 2022 B번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /