harshit2202's blog

By harshit2202, history, 5 years ago, In English

I recently found that s.lower_bound(val) and lower_bound(s.begin(),s.end(),val) have varying time complexities.

Submission-1: (which gave TLE) Sub-1 Submission-2: (got AC) Sub-2

Both submission differ only in lower_bound line. Reasons for varying complexities??

Full text and comments »

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

By harshit2202, history, 5 years ago, In English

I have been doing this code Code Link

Problem is that when I iterating over keys to sort their vector, then sorting is not working properly. Test Case:- 3 4 3 4 3 3 3 7 5 5 1 1 5 3 3 3 7 3 4 1 5 5 3 1 5 3

Input is n and m, then two matrices of n*m

Any idea why? Thanks in advance:)

Full text and comments »

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

By harshit2202, history, 5 years ago, In English

Problem Statement

Unable to solve the problem Editorial is also not available . Can anybody explain? Thanks in advance:)

Full text and comments »

Tags #dp
  • Vote: I like it
  • +7
  • Vote: I do not like it

By harshit2202, history, 5 years ago, In English

I have been trying to run C++ file on Sublime Text 3 (Windows). I got the following sublime-build code

{ "cmd": ["g++","-std=c++14", "{file}", " - o", "{file_base_name}.exe", "&&" , "${file_base_name}.exe<inputf.in>outputf.in"], "shell":true, "working_dir":"$file_path", "selector":"source.c,source.cpp,source.c++", "path": "C:/MinGW/bin", }

But the problem is that if my code goes for TLE, it does not end the code after some time like timeout Rather it just runs infinitely and i have to open task manager to close that .exe file

Any suggestion on how to improve that?

Full text and comments »

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