Codeforces and Polygon may be unavailable from December 6, 19:00 (UTC) to December 6, 21:00 (UTC) due to technical maintenance. ×

find how many numbers in subsequence a[l]...a[r] equal to K

Revision en4, by ATofighi, 2016-01-26 14:55:24

Hi,

Can anyone help me with this problem?

You are given an array with n integers a1, a2, ..., an , a integer K and m queries.

There are two types of query:

  1. give you two integers l and r and ask you to print how many number of integers al, al + 1, ..., ar which equal to K.

  2. give you three integers l, r and v and ask you to add the value of al, al + 1, ..., ar by v.

You should print the answer of the first queries.

Thanks, Sorry for my bad English!

Tags algorithms, data structures, sqrt-decomposition

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en4 English ATofighi 2016-01-26 14:55:24 9 Tiny change: ' to print number of' -> ' to print how many number of'
en3 English ATofighi 2016-01-26 14:45:41 140 (published)
en2 English ATofighi 2016-01-26 14:38:20 17 Tiny change: 'tegers $a_i$ , a inte' -> 'tegers $a_1, a_2, ..., a_n$ , a inte'
en1 English ATofighi 2016-01-26 14:37:12 449 Initial revision (saved to drafts)