### tirupati's blog

By tirupati, history, 6 years ago,

I usually use vector arr[n] to represent the adjacency list of a n-vertex graph. What if I use list instead of a vector. I mean it's O(1) to add an edge in the list similar to vector(amortized) also it's O(n) to check if there is an edge between two vertices in both vector and list. I have seen most people using vector instead of list. Are there any performance costs associated with lists compared to vector?

THANK YOU :)

• 0

By tirupati, history, 7 years ago,

I was solving this problem today and I get a time limit exceeded verdict even though the time limit specified is 5s and the solution is O(n) and given bounds of n is 1<=n<=10^6. The problem can be found here and solution here.

Thank You

PS: Is there a problem with the judge?

• 0

By tirupati, history, 7 years ago,

Today I was trying to solve some questions from codechef and I ran into this question. I tried to optimise it in different ways but I failed in every attempt.

• +8

By tirupati, history, 7 years ago,

This is my first blog post here and also this is the first dp problem I was able to solve by myself. So, I thought I should celebrate it by publishing a blog entry. Here it goes...,