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

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

Hello Codeforces, I have encountered a difficult GCD problem which I am unable to solve any help would be appreciated.

Problem : you are given two arrays A and B . for every i from [1 , N] , find the number of pairs (i,j) such that gcd(A[i],B[j]) !=1.

1 <= N <= 1e5

1 <= A[i], B[j] <= 1e6

Note: one based indexing is being followed here .

I am unable to come up with any approach to solve this problem,any help would be appreciated !

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

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

Автор 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, история, 4 месяца назад, По-английски

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
  • Проголосовать: не нравится