Блог пользователя tirupati

Автор tirupati, история, 9 лет назад, По-английски

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
  • Проголосовать: не нравится

Автор tirupati, история, 9 лет назад, По-английски

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
  • Проголосовать: не нравится

Автор tirupati, история, 9 лет назад, По-английски

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
  • Проголосовать: не нравится

Автор tirupati, история, 9 лет назад, По-английски

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

Полный текст и комментарии »

Теги dp
  • Проголосовать: нравится
  • +4
  • Проголосовать: не нравится