{{ message }}

Instantly share code, notes, and snippets.

# Tanmoy Tapos Datta tanmoy13

Created Jun 16, 2020
View ZOJ 2760 - How Many Shortest Path.cpp
 #include // #include // #include #define pii pair #define pll pair #define sc scanf #define pf printf #define Pi 2*acos(0.0) #define ms(a,b) memset(a, b, sizeof(a))
Created Oct 23, 2018
View CF546-D2-E-Soldier and Traveling(Ford Fulkerson).cpp
 ///Using Maxflow Ford Fulkerson #include // #include // #include #define pii pair #define pll pair #define sc scanf
Created Oct 23, 2018
View CF546-D2-E-Soldier and Traveling.cpp
 /* Author: Tanmoy Datta Solution Idea: --------------- - Make a source. - Make a first group of vertices consisting of n vertices, each of them for one city. - Connect a source with ith vertex in first group with edge that has capacity ai.
Created Oct 8, 2018
View SPOJ: LGLOVE - LCM GCD Love.cpp
 /* Author: Tanmoy Datta Solution Idea: - Most important observation for this problem is after any update the number must be in range 0 to 300000. - So we can precalculate lcm(1,2,3....X) for every X from 1 to 300000. - Now if you think carefully you will find that lcm of a range in array B comes from the maximum number in the given range in array A and on the other hand gcd come from the minimum. - We can process update and query operation for range update and min max query using a segment tree with lazy propagation. */
Last active Jan 16, 2021
View SPOJ: MKTHNUM - K-th Number (Merge Sort Tree).cpp
 /* Author: Tanmoy Datta Solution Idea: - At first take input and store the input in a pair array where first element of i_th pair is the value a_i and second element of i_th pair is i. - Sort the pair array with with ascending order of a_i - Build a merge sort tree using the second element of each pair of sorted pair array. - Now for each query i,j,k at first check how many number in range i to j inclusive are present in left subtree of current node in merge sort tree. Let the value is x. So if x<=k then it's sure that the answer is in the left subtree. So we will go to left subtree of current node with k. Otherwise we will go to right subtree of current node with k-x;
Last active Oct 7, 2018
View Light OJ 1144 - Ray Gun.cpp
 #include #include #include #define pii pair #define pll pair #define sc scanf #define pf printf #define Pi 2*acos(0.0) #define ms(a,b) memset(a, b, sizeof(a))