Number of distinct integers in two subarray

Revision en3, by nima10khodaveisi, 2017-09-13 21:15:39

Hello CodeForces !

We have an array with n integers and Q query. each query has 4 integers L1 , R1 , L2 , R2 such that (1 <= L1 <= R1 < L2 <= R2 <= n) and for answer to query we should print the number of distinct numbers in [L1 , R1] U [L2 , R2] !

I want to answer each query online :)

limits :

1 <= n , Q <= 10 ^ 5

1 <= a[i] <= 3 * (10 ^ 5)

GoodLuck :))

PS a[i] <= 3 * (10 ^ 5) maybe it can help us :))))

PS2 dacin21 solved this problem with an interesting solution :) thanks all

Tags problem, segment tree

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English nima10khodaveisi 2017-09-13 21:15:39 101 Tiny change: 'us :))))\n**PS2** ' -> 'us :))))\n\n**PS2** '
en2 English nima10khodaveisi 2017-09-13 17:53:25 58 Tiny change: '))\n\n**PS : ** a[i] <=' -> '))\n\n**PS** a[i] <='
en1 English nima10khodaveisi 2017-09-13 10:11:04 419 Initial revision (published)