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

Автор CSGO_is_life, история, 8 лет назад, По-английски

I have been trying this question for 2 days. I have come up with a solution which binary searches the minimum temperature and for each possible temperature I check the minimum distance by Dijkstra's Algo. It has passed the sample test case as well as all the test cases of uDebug, but it is giving WA in UVA. Can someone give me some test cases where my code may fail. My solution

Thanks.

UPD — I finally got it accepted. UVA judge penalizes for spaces at the end of each line .... feels sad when an entire day is spent "debugging" an AC solution. The above link now contains my AC solution :).

Полный текст и комментарии »

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

Автор CSGO_is_life, история, 8 лет назад, По-английски

The following message is appearing on all Codeforces pages:

We move the system to other data-center on September 1, 03:00-09:00 (UTC). It is possible that your submissions and other actions will be reverted (not saved).

What does this mean? Will I need to backup my codes? Thanks

Полный текст и комментарии »

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

Автор CSGO_is_life, история, 8 лет назад, По-английски

I figured out a solution for problem Div2C. Given a number n , we have to find its other two Pythagorean Triplets.

My approach was as follows:

I stored the factors of n in a vector. Since we have n*n to deal with, I basically decomposed n*n into all possible combinations of any two of (n*n)'s factors p,q such that p*q = n*n

now, a*a +n*n = c*c

=> n*n = (c-a)*(c+a) = p*q

Now assuming min(p,q) = c-a and max(p,q) = c+a, I just checked if the Pythagorean equation is satisfied. My code

What I still can't figure out in my own code is how my solution gives a correct answer if n is a hypotenuse. I have not handled the case x*x + y*y =n*n. My code seems to prove that if x*x + y*y = n*n, then there always exists a,b such that a*a + n*n = b*b. Simply speaking, hypotenuse of any right angled triangle is always cathetus of some other right triangle. Does this always hold true or is there a counter case. A proof from someone would be really helpful. Thanks :)

Полный текст и комментарии »

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