notsoawesome's blog

By notsoawesome, history, 4 months ago, In English

This is something which I was happy to achieve on my own for 2004D - Colored Portals. I quickly achieved the greedy binary search, but I had few un-intended bugs (ideally would've saved time if I did a code review instead of debugging, but as a trade-off you do get a confidence that it will get resolved after debugging)

Here is the why this blog is for you:

  • You are newb like me.
  • You get frustrated when your code randomly gets WA and you don't know what the edge case/bug is there in your code.

Here is probably why this blog is not for you:

  • You are too good (please ignore, although, you can improvements are welcome!)
  • You probably know what to do, but just don't feel like debugging. (well, that's the only way I know which will work for sure for now)

Thing which helped the most:

Debug template — by Anshul_Johri

TL;DR of the debugger

  1. Write the most correct version you can think of for the solution (i.e via brute force)
  2. Compare them both — to check for wrong answers.
  3. Fix the bugs/edge cases.
  4. Voila!

The code for debugging

My Code

(feel free to suggest improvements which I am sure there will be as my main goal was to fix bugs and not improving my debugger code)

Full text and comments »

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

By notsoawesome, history, 9 months ago, In English

Hi there, apologies for a newbie post. I wanted to know error (possibly corner case) in my code. It would be really heplful.

Actually I want to get back in to competitive programming. Most of the time, I was able to find the corner cases to my error prone code, but since I lost the habit of doing competitive, I am having trouble with this simple thing.

Here is the problem: https://mirror.codeforces.com/contest/1935/problem/C

And here is my code: https://mirror.codeforces.com/contest/1935/submission/251937077

What I tried to do is simple. Sort in terms of b, and then finding the appropriate a's between two indexes and brute forcing it across the array to get the maximum.

In order to find a efficiently, I used multiset.

  • first optimizing as per the lowest possible a's and removing the largest
  • and then adding whatever we can

It would be really helpful. Thanks!

Full text and comments »

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

By notsoawesome, history, 3 years ago, In English

Sorry, I am getting back into competitive programming after a bit of gap, so sorry if there might be some silly implementation error
The link to the problem is here: 1660D - Maximum Product Strikes Back
My Submission 153302296

(Here a bit of explanation of my logic, ofc what needs to be done is very obvious, we need to look at sub-arrays between two zeros, its only the implementation that depends on your method, I first made an array containing indexes of zeros and then I pass those indexes to a function that calculates the left, right for that particular subarray and updates global ans, global left and global right. and as multiplication will overflow, I used mul function (which basically adds instead of multiply and takes care of sign accordingly)

Thanks.

Full text and comments »

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

By notsoawesome, history, 5 years ago, In English

Hello everyone, with the help of you guys and helpful blogs, I am able to solve A and B pretty much every time, and most of the time C too(Div >=2 of course).

Here is the problem->Contest #576 Div2 C-MP3

And here is my code->here

For those of you who don't want to see code, here is what I did

-made vector of distinct intensities(which is sorted)

-maintained a freq map for frequency of those intensities

-while the condition of the bits is not satisfied, greedily removed the digits from left and right using two pointers

Full text and comments »

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

By notsoawesome, history, 5 years ago, In English

Tricks: here(Thanks to vaibhav1997)

awesome list: here(Thanks to lnishan)

competitive programming tutorials: here

a2oj: here

problem classifier(spoj) :here

code library :here

calendar :here

about typing speed :here(Thanks to Penguin)

some intense templates : here(Thanks to MinakoKojima)

Topic wise Coding Resources : here (Thanks to hsk)

Way to practice competitive programming :here (Thanks to E869120)

DP tutorial : here(Thanks to Ahnaf.Shahriar.Asif)

// Share this list and comment more useful links like this which needs serious attention of noob like me.

Full text and comments »

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

By notsoawesome, history, 5 years ago, In English

Hello everyone, I am quite new over here as you can see... and when I look at some of your codes, they look much different than me. Of course, the logic is the same(Okay, sometimes totally different) but they have some different way of writing it. So if some of you guys out there who can suggest a source to achieve that kind of format, that would be nice. My style of coding is very sloppy and sometimes I am unable to see what I have done.

Also, I find it quite difficult to do Div. 2 problems I am only able to do 1 or 2, and sometimes to my surprise...none. So I think that it is useless for me to directly jump into the competition. So for me, what are the things that I should cover. For example, Some of the problems require a strong grip on some of the crucial concepts of maths and algorithms. So can some of you suggest a source (For example A Book, Or Videos, Or... whatever you know) where I can learn the things and all important concepts required for competitive coding.

Full text and comments »

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

By notsoawesome, history, 5 years ago, In English

Hello everyone, I am quite new to code-forces and I noted that there are some issues with the code-forces compiler but it turned out to be my mistake, but here in this particular question I cannot find any mistake. Question Link: Here--->http://mirror.codeforces.com/problemset/problem/393/B And my solution(ya, don't judge why am I solving such dumb questions...) My Solution: Here--->http://mirror.codeforces.com/contest/393/submission/56501161

->I also tried taking input as double but still, it gave output as all zeros( it's rather unnecessary as it's mentioned that all inputs are integers) ->It works perfectly fine in online gdb ... etc. ->Please look up to it, as something like this also happened to me during contests too.

Full text and comments »

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