MohamedHamada_'s blog

By MohamedHamada_, history, 7 weeks 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 :)

Read more »

 
 
 
 

By MohamedHamada_, history, 7 months 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 :

16

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 :)

UDP :

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.

Regards.

Read more »

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

By MohamedHamada_, history, 8 months 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 ?

Read more »

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

By MohamedHamada_, history, 17 months 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 :)

Read more »

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