## DMPG '18 S5 - Mimi and Division

View as PDF

Points: 15 (partial)
Time limit: 2.5s
Memory limit: 512M

Author:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

For her birthday, Mimi is given an array of integers. She then proceeds to perform operations:

1. 1 l r x: Count how many numbers there are in the subarray which are divisible by .
2. 2 u v: Replace the number with .

Because you forgot to get Mimi a present, you decide to write a program to verify her answers.

#### Constraints

For all subtasks,

#### Input Specification

The first line will contain and .
The next line will contain space separated integers, .
The next lines will each contain a valid query.

#### Output Specification

The answer to each query of type , each on a new line.

#### Sample Input

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

#### Sample Output

5
2
1
2

## Comments

• commented on May 23, 2018, 9:08 p.m.

This comment is hidden due to too much negative feedback. Click here to view it.

• commented on May 25, 2018, 12:57 a.m.

Editorials do not exist so that you can get free points.

• commented on May 13, 2018, 2:45 p.m.

Will an editorial be opened for this question?