Vedkribhu's blog

By Vedkribhu, history, 5 months ago, In English

I am not able to find online round registration portal. Anyone has any idea about dates this year...

Read more »

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

By Vedkribhu, history, 7 months ago, In English

Problem: link. I can find number of ways to get sum in that range using dp, but the total number of ways is 6**100 that is impossible to store(or I don't see how to). How to solve this?

Read more »

 
 
 
 
  • Vote: I like it
  • -9
  • Vote: I do not like it

By Vedkribhu, history, 8 months ago, In English

I was doing this graph problem from CSES link. I am getting TLE in only one sub task. I am new with c++, can you take a quick look, why it may fail for big sub task. Algorithm is just a simple BFS. My Code.

Read more »

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

By Vedkribhu, history, 8 months ago, In English

Problem: Link I was using Bellman Ford to solve this. To detect a cycle in bellman ford we usually do one more pass on the edges (after n-1) passes and see if anything updated, if yes there is a cycle. But in this problem even if there is a cycle in graph but not a part of path between vertex 1 and n is tolerable. How to detect when to print -1?

Read more »

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

By Vedkribhu, history, 8 months ago, In English

Should I upsolve problems with rating much higher than my current rating? Example my rating is 1600 should I upsolve 2200+ rated problems?

Read more »

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

By Vedkribhu, history, 8 months ago, In English

For some testcases I am getting a run time error while it runs fine on my local machine. Problem code. Any help would be awesome.

Read more »

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

By Vedkribhu, history, 8 months ago, In English

I Dijkstra's algorithm we need to maintain heap for vertices who are not finalised. We need to modify the value of keys in the min heap. How can we do that without using custom heap written ourselves, but instead using Standard heap library like Heapq in python. I found this on stackoverflow but it is linear time to modify, can we do in logarithmic time complexity for decrease key? Any answer related to c++ or python will be awesome.

Read more »

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

By Vedkribhu, history, 9 months ago, In English

Problem: link Code in c++ which produces different output for k=10^5. Same logic in python giving AC.

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
long long p = 1e9+7;
 
int main(){
	ll k;cin>>k;
	ll i,j,dp[100005], par[2] = {1,0};
	for(i=1;i<k+1;i++){
		dp[i]+=(par[(i+1)%2])%p;
		par[i%2]+=(dp[i])%p;
	}
	cout<<dp[k]%p<<endl;
}

Read more »

 
 
 
 
  • Vote: I like it
  • -22
  • Vote: I do not like it

By Vedkribhu, history, 9 months ago, In English

I wanted to switch to a fast language, and as c++ is the go to language for the competitive programming I shifted to c++. It is now around 15 days I have been trying to get familiar with c++. I feel a strange uneasiness while implementing problems in c++. I need to google a lot of syntax. And c++ comes with the lack of freedom which python used to provide. Is it a complete different mindset for coding in c++ and python, or is it a thing which will go away as I make progress in c++? Has anyone been in such a situation? What is a good way to learn syntax faster, right now I tend to see a lot user submissions to learn new tricks and tips. But if I try implementing heavy implementation problems by myself it generally takes 2-3 hours. Long debugging hours eat all my time for problem solving practice. Any suggestions will be nice.

Read more »

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

By Vedkribhu, history, 9 months ago, In English

I am new to c++. Please somebody help me in this Problem: 1296C - Yet Another Walking Robot. My submission 80772232. My approach is similar to the editorial but I suspect some implementation issue is causing TLE.

Read more »

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

By Vedkribhu, history, 10 months ago, In English

Hi folks, I came across this website for visualization of data structures. https://www.cs.usfca.edu/~galles/visualization/Algorithms.html

Read more »

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