tirupati's blog

By tirupati, history, 9 years ago, In English

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 :)

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By tirupati, history, 9 years ago, In English

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?

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By tirupati, history, 9 years ago, In English

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.

Full text and comments »

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

By tirupati, history, 9 years ago, In English

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...,

Full text and comments »

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