Comments
0

I am getting WA for DIV2 B . Please help. Stuck for long. Link to solution

Thanks in advance.

0

Can somebody explain the logic behind the question, i.e how to find the min and max number of files? Thanks.

On darksiderGoogle APAC Round B 2016, 11 years ago
0

I also need help regarding the same question. Please Help.

I looked at the editorial . I couldn't understand it completely. Can you provide some help?

Auto comment: topic has been updated by wadhwasahil (previous revision, new revision, compare).

In my opinion O(nlogn) should pass easily. However , only 11 submissions have been there so far for this problem.

but how will I delete a node ? I mean, if I have a node A (val=10 & rank=1,3,5,10) and its in-order successor node B(val=12 & rank=2,4) . So I have to copy the entire node(val and queue) of node B to node A. Won't it lead to TLE?

I want the ith element a[i] after many updations .

a[]={1,2,3,4,5};

query1=1 4 3 // this means change the value of all elements to 3 in the range [1,4] so after first query a becomes a[]={3,3,3,3,4,5};

query2= 3 4 1 // this means change the value of all elements to 4 in range [3,4] a become a[]={3,3,1,1,4,5}

so I want the value of a[3](which is 1 in this case) after many queries. Hope you guys understood the question.

0

Please can somebody explain how to change all the elements of an array in an interval [l,r]to a constant value v using lazy propagation.

Thanks.

On LewinCodeforces Round #309 Editorial, 11 years ago
0

Can anyone please explain how did DIV2D get fib(n) as the total number of valid permutations? If someone can provide a recursive formula , it would be great. Thanks.

On iamdumbLongest path in the tree, 11 years ago
0
void dfs(int v,int l){
visited[v]=true;
int i;
for(i=0;i<s[v].size();i++){
    if(!visited[s[v][i]]){
        dfs(s[v][i],l+1);
 
    }
}
if(l>best){
            best=l;
            node=v;
        }
visited[v]=false;
 
}
  1. v = current vertex of the tree
  2. l = distance of v from the source/root vertex
  3. s = adjacency list

Hope you understand the code.