Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

coderbond007's blog

By coderbond007, history, 5 years ago, In English

Java 12 has been released a few days ago.

Have anybody noticed any additional features proposed in Java 12 release which are useful in Competitive Programming?

Please post enhancements which you think is are related to the community.

Previous posts regarding same are: Java 8, Java 9, Java 10 and Java 11

Important features in Java 12 for Competitive Programming:

  1. Switch Expression (Thanks to WaterColor2037)

Full text and comments »

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

By coderbond007, history, 6 years ago, In English

From few days, I have been thinking about a problem. But I can't figure out the solution.

Suppose you have an undirected graph having N nodes and M edges given. Given graph is initially a single connected component. Now the problem is, we have to delete a node of the graph such that remaining graph should be a single connected component. And this process should be repeated until the graph vanishes.

Now, we need to find the number of ways of doing it. Suppose graph is N = 6 and M = 7 as shown here

 Graph

One way to delete the above graph is 2 — 3 — 5 — 6 — 1 — 4 (order of deleting the nodes).

Second way to delete the above graph is 2 — 3 — 5 — 6 — 4 — 1 (order of deleting the nodes).

Another way to delete the above graph is 2 — 5 — 6 — 3 — 1 — 4 (order of deleting the nodes).

Incorrect way of deleting the graph is 1 — 2 — 3 — 4 — 5 — 6 (Graph got disconnected after deleting node 1)

Can anybody help me with this question solution? Thanking all in advance.

Full text and comments »

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

By coderbond007, history, 7 years ago, In English

Problem says that we have to get rank of the favourite team after updating rank of team t at each query. Can anybody suggest me how to solve this online query problem?

Full text and comments »

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

By coderbond007, 7 years ago, In English

How can we calculate number of node — disjoint paths pair between u and other vertex say v (such that distance of v from source vertex is K).Vertex v is not known to us. I thought of implementing BFS for every node until maximum distance from source node is <= K. But I am not getting idea for implementation. Anybody please help me? Given the number of vertices in graph can be up to than 10^5 and edges can be 6 * 10^5. In every test case, value of K will be at max 10 % of number of edges.

A path is sequence of vertices: s, v_1, .., v_m, t. Two paths s, v_1, .., v_m, t and s, u_1, ..., u_k, t are called node-disjoint if v_i != u_j for any valid i and j.

We are given a example graph shown as following. Adjacency List representation of given Directed Graph

1 - 2, 5
2 - 3, 4, 6
3 - 4
4 - 8
5 - 7
6 - 11
7 - 11
8 - 9, 10
9 - 10
10 - 11

Value of K is 6(including source node and end node). Graph

Total node — disjoint path pairs possible are 3(between 1 and 11) + 1(between 2 and 4) + 1(between 8 and 10). In case of path of 1 to 11

Path 1: 1 - 6 - 11
Path 2: 1 - 2 - 4 - 8 - 10 - 11
Path 3: 1 - 5 - 7 - 11

Total combinations = Comb(3, 2) = 3

Anybody please help me out with implementation using BFS or DFS of above question. Can this question be solved using DP + DFS or DP + BFS?

UPD : In every test case, value of K will be at max 10 % of number of edges.

Full text and comments »

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

By coderbond007, history, 7 years ago, In English

I was solving this problem. As no editorial is provided for this solution. Can anybody help me to figure out how to calculate XOR between each pairs of integers (i, j) such that 1 ≤ i ≤ j ≤ N?

Full text and comments »

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

By coderbond007, history, 7 years ago, In English

Can anyone suggest me some Splay Tree problems on CodeForces? I want to solve those problems that have solutions and editorials open.

As I can't find Splay tag in problemset, I think these problems are under Data Structures tag, but how do I find them?

Full text and comments »

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