alpercakan's blog

By alpercakan, history, 9 years ago, In English

Since n <= 100, I thought backtracking wouldn't be fast enough (not tried). So, only other solution I could think is greedy solution (sort vertices by degree, start coloring from the one with lowest degree). It seems correct to me (altough I can't prove it) but it gives WA. Anybody can show me how to prove or disprove it (Or maybe how to make greedy work, maybe with some change like trying all nodes with the same degree)?

Full text and comments »

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

By alpercakan, history, 9 years ago, In English

For the problem UVa-579 I get AC if I use ((h*60)*0.5)+(m*0.5)-(m*6) for calculation, but if I use (h*30+m/2)-(m*6) I get WA. I know that it's something about precision problem (like comparison), but answer is printed with 3 digits after decimal point; so I didn't think this kind of change in calculation would be a problem. I don't know what's the best way for this kind of calculations. How should I calculate?

Full text and comments »

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