rishichowdhury711's blog

By rishichowdhury711, history, 3 months ago, In English

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 !

Full text and comments »

  • Vote: I like it
  • +1
  • Vote: I do not like it

By rishichowdhury711, history, 4 months ago, In English

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

Full text and comments »

  • Vote: I like it
  • +4
  • Vote: I do not like it

By rishichowdhury711, history, 5 months ago, In English

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

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it