-emli-'s blog

By -emli-, history, 7 years ago, translation, In English

Hello everyone!

Today at 15:00 MSK will be held personal competition.

I invite everyone to participate and let's discuss problems after the contest.

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

| Write comment?
»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

How write third problem shortly ? I have very long and wrong solution.

  • »
    »
    7 years ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    Since sx < tx and sy < ty, it is trivial that first to-and-fro path is going to be a rectangle with (sx, sy) and (tx, ty) as opposite vertices.

    The second to-and-fro path is around the same rectangle, taking four extra edges, effectively :

            fl(i,0,abs(y0 - y1))	printf("U");
    	fl(i,0,abs(x0 - x1))	printf("R");
     
    	fl(i,0,abs(y0 - y1))	printf("D");
    	fl(i,0,abs(x0 - x1))	printf("L");
     
    	printf("L");
     
    	fl(i,0,abs(y0 - y1) + 1)	printf("U");
    	fl(i,0,abs(x0 - x1) + 1)	printf("R");
     
    	printf("D");	printf("R");
     
    	fl(i,0,abs(y0 - y1) + 1)	printf("D");
    	fl(i,0,abs(x0 - x1) + 1)	printf("L");
     
    	printf("U");
    
    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      So answer is coordinates of two rectangle ? Second rectagle is bigger than first?