MohamedHamada_'s blog

By MohamedHamada_, 3 years ago, In English

Hello CF community...

2 days ago, It was my last regional contest (ECPC). for the last 5 years, I was training for the ACM while studying (like most of us) and help the other newcomers in the problem-solving community. In the last ECPC, one of the students who I was training had really bad luck in the contest and spent too much time on one easy problem and didn't solve it! I think most of us have experienced this. anyway, After the contest, she said I have no reason to continue the training! I did my best last year and didn't get any good results! and I even don't know what's the benefits of problem-solving in a practical job after leaving competitive programming! (we all will leave these competitions one day, whatever the reason) she was really disappointed. I know that feeling and I reach a mental breakdown 2 years ago (still trying to recover).

competitions -like anything in life- have advantages and disadvantages, you may work very hard and things go wrong! you got WA instead of first accepted in the contest because you forgot to add the file name and end up with 11th place while all honor goes to the top 10 places! and there are too many other reasons! (maybe really 13 reasons why). and we end up with some small percentage of people with honor and prizes/medals/cups and some other disappointed people! despite all the advantages of competitive programming I still find it a very very toxic community!

back to the main subject, I have many questions... and I hope this blog be a reference for anyone who will experience the same feelings/questions... After getting enough competitions(regardless of the reason),

  • is it really worth it?

  • did you use it in your job?

  • did you still train after you got -whatever- job and you find out you still want to be better in topics such graphs for example?

  • how to avoid the side effects and toxicity of the competitive environment?

  • and what would you say to anyone worked very hard but didn't get any good place and feel disappointed or maybe he felt he wasted the time, it may be better to spend the time to study for the market jobs for example ( Web, Machine learning / Data science/ .etc)?

  • for those who can't participate anymore, what's next?

please discuss any question/point you have experienced, and if there are other blogs/articles that discussed the same points leave the link/s in a comment. any help appreciated, Thanks in advance.

Full text and comments »

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

By MohamedHamada_, history, 5 years ago, In English

I was solving the problem UVa 10368 and after thinking for a while i came up with this solution:

The first player have a number n%m == 0 or n/m > 1 is the winner and got AC ! :D

I just observed this solution when i tried some numbers on a paper but i actually don't have a rigorous proof for that ! could you demonstrate why this solution works ?

Thanks in advance :)

Full text and comments »

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

By MohamedHamada_, history, 6 years ago, In English

in the 313C i tried to solve it recursively. then i got WA (i expected either AC or TLE Due to the recursion complexity )

i tried this test :


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

following the problem description , i have 2^2 * 2^2 matrix so i pick the max number = 16 and then divide the matrix to 4 2*2-matrices

next, for each 2*2 matrix i choose the max number and then divide each sub-matrix to another 4 submatrices of size 1*1

this the base case so the answer so far ( due to my solution ! )

= 16 + 6 + (1+2+5+6) +8 +(3+4+7+8) +14 + (9+10+13+14) +16+(11+12+15+16) = 196 [Wrong answer !]

i cloned an accepted code and tested my above test case and the answer = 210 (not 196 )

this is my Submission

any help appreciated , Thanks in advance :)


i wasn't Sort the numbers in such way that maximize the answer , the right matrix for the above input :

and the answer = 16 +(16 + ( 11+12+8+16) + 15+(9+10+6+15) + 14+(3+4+7+14) + 13+(1+2+5+13)) = 210

thanks for you help.


Full text and comments »

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

By MohamedHamada_, history, 6 years ago, In English

hello codeforces community ,

I was looking forward to the next round but it comes in inappropriate time(for the Muslims). on Friday , Muslims have to pray the "Friday prayer" and this prayer start at 12PM[Cairo local time] and last for 1 hour. could the contest time changed so that it doesn't contradict with the prayer time ?

Full text and comments »

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

By MohamedHamada_, history, 7 years ago, In English

i tried to solve this problem in the contest time but it gave me a WA . today i try to understand why my answer is wrong .i used an accepted code and try some test cases ... one of them was :

so it locks like :

and the the fences should (i think) be like :

so my answer is 5 ... but the Accepted code output is 3 !

i can't understand how to but only 3 fences to prevent the snakes communicate with each other . can any one explain this problem to me ?

thanks in advance .

UPD: the optimal solution for the above sample :

Thanks :)

Full text and comments »

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