시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB23111147.826%

문제

You are given a sequence of N numbers and Q queries:

  • 0 a b val : the number val will be added to all of the numbers from the interval [a,b]
  • 1 a b : you need to print the minimum even number and the maximum odd number form the interval [a,b]; if one of these numbers does not exist, -1 will be printed in its place

Answer all of the type 1 queries.

입력

The first line contains one integer: N. The second line contains N integers, representing the numbers from the sequence. The third line contains one integer: Q, and the following Q lines contain Q queries, as described in the statement.

출력

The output contains the answers to all of the type 1 queries, one per line.

제한

  • The numbers from the sequence are between 1 and 2.000.000.000.
  • The numbers “val” from type 0 queries are between 1 and 2.000.000.000.
  • WARNING!! If one of the answers to a type 1 query cannot be calculated, -1 will be printed in its place!!

서브태스크

번호배점제한
130

N, Q ≤ 5000

230

N, Q ≤ 200,000 and there are no type 0 queries

340

N, Q ≤ 200,000

예제 입력 1

7
5 6 3 1 9 8 5
10
1 2 5
0 2 3 2
1 2 4
0 2 7 3
1 2 4
1 4 7
0 5 7 1
1 1 6
1 1 2
1 3 4

예제 출력 1

6 9
8 5
4 11
4 11
4 13
-1 11
4 -1

The initial sequence is: 5 6 3 1 9 8 5.

  • Query 1 2 5: You will print the specified two numbers from the interval [2; 5].
  • Query 0 2 3 2: The new sequence is 5 8 5 1 9 8 5.
  • Query 1 2 4: You will print the specified two numbers from the interval [2; 4].
  • Query 0 2 7 3: The new sequence is 5 11 8 4 12 11 8.
  • Query 1 2 4: You will print the specified two numbers from the interval [2; 4].
  • Query 1 4 7: You will print the specified two numbers from the interval [4; 7].
  • Query 0 5 7 1: The new sequence is 5 11 8 4 13 11 8.
  • Query 1 1 6: You will print the specified two numbers from the interval [1; 6].
  • Query 1 1 2: You will print the specified two numbers from the interval [1; 2].
  • Query 1 3 4: You will print the specified two numbers from the interval [3; 4].

채점 및 기타 정보

  • 예제는 채점하지 않는다.