gkeesh7's blog

By gkeesh7, history, 9 years ago, In English

Greetings Everyone,

If you use Code::Blocks as your IDE and are a bit bored with the same plain vanilla codeblocks theme , Follow this installation guide to get the custom colourful new Themes :- link

Steps for installation Mentioned here :- link

Some of the themes

VIM

VIM

Sublime

Sublime

ModnokaiNightShift_v2

ModnokaiNightShift_v2

Bright Yellow

Bright Yellow

Note :-

1) If you tend to use dark themes , don't forget to change the cursor colour to white

To change cursor colour just goto Settings -> Editor -> Margins and Caret -> Caret -> Colour

2) Always backup your default.conf file before replacing it

3) My system has Code::Blocks Version 12.11 and Windows 8.1 don't know much about how to do it in Linux but I think it would probably be the same.

Full text and comments »

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

By gkeesh7, history, 9 years ago, In English

Greetings Everyone,

I was doing the maximum enclosing circle problem, This is the subproblem of that.

Given two ends points of a common chord of two circles of equal radius say R find out the coordinates of two centers of the circles (without much precision loss preferably)

The condition can be pictorially represented like.

A possible solution might be to find the coordinates of mid point of A and B that is M which is

Since the slope of line joining A and B is and since the line joining the centers would be perpendicular to the slope of line joining C1 and C2 would be .

The distance between the points M and C1 or C2 can be found using pythagoras theorem i.e. where

Now since we know the slope of the line and a point on it and distance between the points we can now find the coordinates of centers, but It's highly insensitive to precision.

Any other method, resource , links etc would be deeply appreciated.

Thanks in advance.

Full text and comments »

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

By gkeesh7, history, 10 years ago, In English

Greetings Everyone,

I know this sounds pretty much like a homework problem that's why I was hesitant to ask it in the first place. (I could have asked someone through a PM but I have lost faith in such methods lately)

Anyways,

There are 3n balls in total, of 3 different colours , (i.e. n balls of each colour) find the number of ways you can arrange them in a row such that no two balls of the same colour are adjacent

The various approaches which I could google include,

1 ) Principle of Inclusion and Exclusion :- It stated Find the total number of ways of arranging 3n balls with the constraints (i.e. n identical balls of each colour) then subtract from it the number of ways in which atleast two balls of same colour are together. But I couldn't derive a formula from it :( the one I derived was wrong.

2 ) Someone on Quora said to brute force till n=5 and guess the formula.

3 ) Suggestions of O(n^3) DP from a freind. Don't know how to do it.

I still think this is a pretty standard Permutations problem but sorry I guess my googling sucks.

Any Resource / Approach / Formula would be deeply appreciated.

I am sorry if this is a stupid problem, Also if you would like to answer a follow up.

I was thinking of generalizing this problem to kn balls and k different colours. How to do it ?

Thanks in Advance.

Full text and comments »

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

By gkeesh7, 10 years ago, In English

Greetings Everyone, It's just one of those days when I feel too lazy to solve any problems on Codeforces but don't feeling like doing anything else either. In the past few contests I have been annoyed by bugs which result in WA/TLE etc and wanted to know is there any systematic approach to problems testing in competitive programming which can be applied to remove bugs, that too in an intense pressure situations (like ICPC). Because most of the time while I am testing some bug in my implementation, I throw random testcases at the solution and expect it to fail and incase it does I consider myself really lucky. I would like to ask all the experienced guys about any tips/tricks/tools for testing the solutions which they would like to share.

So far after messaging some people the valuable tips that I have received include

(text in italics are excerpts of actual messages received)

1) Reading the problem statement carefully

(not so valuable but still important :)

2) Emphasize on constraints of the problem

"test on atleast one maxtest"

3) The tricky base cases

"zero in most of the cases is tricky but at times other numbers may also be you can't possibly generalize"

4) Learn to use gdb or any debugger

"if you keep adding printf/cout statements to check value of variable in each iteration not only that is time consuming but also looks unprofessional learn to use Gdb also modify your template with some cerr messages as I can see there aren't any:)"

5) Generate your own maxtest

"i generally use python to generate my own maxtest file which is cool considering it takes only 5-10 lines of code"

Some of the questions which want to ask include

Do you use some generators etc ? If yes which ones ?

What are your thoughts while writing a manual test for the code ?

How are you able to keep yourself calm incase of a wrong attempt ?

Feel free to share any ideas/tips/tricks in the comments section below.

[ UPD ] Some of my friends have told me to ask the following questions to guys who have experience at writing system tests at codeforces or any other platform.

1) What do you guys do to ensure the completeness of the test cases ?

2) What do you guys consider while writing the maxtests ?

3) Do you classify your tests in categories like Pretests , Easy , Overflow possibility , TLE possiblility , Random cases, Not initialized variables will fail, Tricky basecases, Chances of accessing invalid memory address etc ?

Full text and comments »

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

By gkeesh7, 10 years ago, In English

Hello everyone!! I have seen recently, that most of the Classical problems on Spoj Which used to be on the Pyramid Cluster (733 MHz) have now been migrated to the Cube Cluster (3 GHz). Just wanted to know Is it a good move or not, in your opinion ?

Does this up gradation affect the way people approached the Classical Problems on Spoj ? because time limits of some tasks are way too liberal (as far as C++/C are concerned) .

I know that time limits would have been carefully calculated so that solutions of inappropriate complexity would not pass, but still will this up gradation let unoptimized solutions pass like the ones with a higher constant factor which earlier used to time out ?

Or do you think it's a move to give breathing space for languages like Python etc.
Plus wouldn't that be a bit unfair for the guys who solved those problems like 2-3 years ago and got TLE for the above mentioned reasons.

Thanks in advance

Full text and comments »

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