## DMOPC '15 Contest 1 P6 - Lelei and Contest

View as PDF

Points: 17 (partial)
Time limit: 1.0s
Memory limit: 256M

Author:
Problem types

Lelei La Lalena has been studying competitive programming in our world. Today, she decides to do a contest on DMOJ to prove her skill! Confident, Lelei opens the sixth problem of the October 2015 DMOPC and finds a really abstract problem with no story. So she decides to make one up and tell FatalEagle to add it to the problem. Anyway, here's the original problem:

Rory is playing with an array consisting of integer elements indexed from to and a positive integer . Rory will perform operations. Each operation is either type 1 or type 2.

Type 1 operation is in the form . You should add to each element in .

Type 2 operation is in the form . You should output the sum .

Lelei is confident she can solve this problem, so she tells you that she doesn't need your help, as she can solve it faster than you. Seeing this as a challenge, you obviously want to show Lelei that she could have a better time penalty, if only she asked for your help. Can you prove her wrong?

#### Input Specification

The first line of input will contain three integers , , and .
The second line of input will contain elements, the original elements of array in the order .
The next lines of input will contain an operation, either in the form for an operation of type 1 or for an operation of type 2.

for all valid .

#### Output Specification

For each operation of type 2, output the answer on a new line.

#### Sample Input

2 5 3
1 2 3 4 5
2 1 4
1 2 5 7
2 1 5

#### Sample Output

0
1

#### Explanation

For the first operation, , and .
For the second operation, the array is now .
For the third operation, and .

• commented on June 14, 2019, 7:37 p.m.

How come the author doesn't mention M as prime ?

• commented on June 15, 2019, 11:41 a.m. edited

Because maybe thats something you can observe yourself?

• commented on Dec. 31, 2015, 12:51 p.m.

This comment is hidden due to too much negative feedback. Show it anyway.

• commented on Dec. 31, 2015, 1:09 p.m.

No comment, reread the problem statement.

• commented on Dec. 31, 2015, 1:33 p.m.

This comment is hidden due to too much negative feedback. Show it anyway.

• commented on Oct. 13, 2015, 6:01 p.m.

A link that will take you to the exact same web page?

• commented on Oct. 13, 2015, 7:13 p.m. edit 2