kingofnumbers's blog

By kingofnumbers, 4 years ago, In English,

Hello problem solvers!

I'm glad to invite you to participate in HackerEarth September Easy Challenge. it will start on September , 1st at 16:00 UTC, link of the contest: September Easy Challenge

There will be 6 algorithmic problems of varying difficulties (from easy to medium) and you will be given 3 hours to solve them, each problem is worth 100 points and partial points is allowed (you will be given points of each test case you pass). Top 5 beginners will receive HackerEarth T-shirts.

Problems are set by subway, Tested by Me kingofnumbers and the editorialist is ikbal

we did our best to prepare the contest so we hope you enjoy it and benefit from it.

looking forward to see you on the contest , Good luck!

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

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Is the contest individual or team participation ?

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Is there penalty for time?

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Is the number of tests the same for all problems?

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Congratulations to the winners! https://www.hackerearth.com/september-easy-15/hof/ Also, the editorials are out. :)

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I was trying the last problem from the contest -- here

my documented solution here I would be glad if someone can look into the solution and figure out the anomaly in it. Thanks.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    You are calling function dfs(i, j) from top left to right down which is very wrong. Instead call it in the increasing order of cell values i.e. from (i, j) such that a[i][j] = 1 to (k, l) such that a[k][l] = 100.

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I thought over what you suggested but I still can't figure out how positions of launching dfs will affect the result. it would be great if you could give a small counter test case , that would make things clear ,and thanks for your time.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +5 Vote: I do not like it

    Error is in your dfs function inside the loop, in the nested if statement it should be:

    if(!vis[x+adj[0][i]][y+adj[1][i]])

    instead of:

    if(!vis[x+adj[0][i]][x+adj[0][i]])

    And use long long for storing ans, just to be safe.

    Here is the working code

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      thanks a lot shubham for taking out the time and looking into the code. btw pathetic mistake on my part :(.

»
4 years ago, # |
  Vote: I like it +9 Vote: I do not like it

Oh, by the way, if anyone is interested in setting / testing, or writing editorials for the future Easy contests, they can drop me a message.