For a person who can do div 2 A and B comfortably and sometimes C, does practicing on D make sense. Will participating in div 1 virtual so that I start from div 2 C (div 1 A) help or should I stick to solving only C and D? Thank you.

# | User | Rating |
---|---|---|

1 | tourist | 3496 |

2 | W4yneb0t | 3218 |

3 | TakanashiRikka | 3178 |

4 | Petr | 3173 |

5 | moejy0viiiiiv | 3158 |

6 | LHiC | 3113 |

7 | izrak | 3109 |

8 | anta | 3106 |

9 | ershov.stanislav | 3105 |

10 | cubelover | 3071 |

# | User | Contrib. |
---|---|---|

1 | rng_58 | 178 |

2 | csacademy | 171 |

2 | tourist | 171 |

4 | Petr | 162 |

5 | Swistakk | 161 |

6 | Errichto | 156 |

7 | Zlobober | 150 |

8 | matthew99 | 145 |

9 | Endagorion | 142 |

10 | zscoder | 134 |

In Dinic algorithm for maximum flow, we in dfs we write the function as

```
for(int &t = ptr[source]; t < neighbours of source ; ++t)
```

I read that ptr is an array used to make finding the blocking flow in O(m) rather than O(m2). Why does this work and what is the exact use of keeping the ptr array. How does this array work?

I came across this implementation of treap split function

```
void split(pnode root, int key, pnode &l, pnode &r){
if(!root){
l = NULL;
r = NULL;
}
else if(key < root->key){
split(root->l,key,l,root->l);
r = root;
}
else{
split(root->r,key,root->r,r);
l = root;
}
}
```

where pnode is pointer to node. I have a difficulty in understanding the call to split function. if key < root->key, I understood that we need to make root as the root of the right subtree so r = root. And we need to split left child. So split(root->l,key,?,?) the doubt is why we pass l as left pointer and root->l as right pointer. Thank you

By Graham Scan O(n*n*logn) would be possible for online construction of convex hull. Can you help me with O(n*n) algorithm. Also what is the difference between 2D CH construction and 3D CH construction

And in graham scan there is a function to sort according to polar order which i did not understand. Please help.

```
bool polar_order(Point a, Point b){
//ccw is a function that returns 0 if collinear -1 if counter-clockwise and 1 if clockwise
//pivot is the lowest y-coordinate point(tie broken by lowest x-coordinate)
int order = ccw(pivot,a,b);
if(order==0)
return sqrdist(pivot,a) < sqrdist(pivot,b);
return (order==-1);
}
```

Also if there are some problems you know of convex hull, please share them. Thank you.

Codeforces (c) Copyright 2010-2017 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Oct/20/2017 00:40:45 (c3).

Desktop version, switch to mobile version.

User lists

Name |
---|