Блог пользователя kingofnumbers

Автор kingofnumbers, 9 лет назад, По-английски

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!

  • Проголосовать: нравится
  • +24
  • Проголосовать: не нравится

»
9 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Is the contest individual or team participation ?

»
9 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Is there penalty for time?

»
9 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Is the number of tests the same for all problems?

»
9 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
9 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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.

  • »
    »
    9 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    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.

    • »
      »
      »
      9 лет назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      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.

  • »
    »
    9 лет назад, # ^ |
      Проголосовать: нравится +5 Проголосовать: не нравится

    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

    • »
      »
      »
      9 лет назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

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

»
9 лет назад, # |
  Проголосовать: нравится +9 Проголосовать: не нравится

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.