Блог пользователя rishichowdhury711

Автор rishichowdhury711, история, 3 недели назад, По-английски

Hello codeforces , I have a problem which I am unable to solve.The Problem is that you are given an array of length n (1 <= n <= 1e5) . Also you are given q (1 <= q <= 1e5) queries of form (l,r) where (1 <= l <= r <= n) . For each query you have to find the sum of distinct elements in the subarray [l,r].

For example :

if arr[]={1,2,3,4,4} and q=2, and the queries are:

1 3

2 5

so for the above queries the answer would be :

6

9

I am unable to solve this question. Any help regarding this would be helpful .Thank you

Полный текст и комментарии »

  • Проголосовать: нравится
  • +4
  • Проголосовать: не нравится

Автор rishichowdhury711, история, 6 недель назад, По-английски

Hello Codeforces , I have a question regarding the problem D of the previous contest. I just solved the question using brute force and DSU and it got accepted. I dont understand why it is not giving TLE. It would be really helpful if you can please explain the reason for the code getting accepted or the testcases are weak. Thank you here is the Code

Полный текст и комментарии »

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится