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

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

Do I just have to switch over from java? Full code: https://pastebin.com/5HDQ6kRa

The logic should be correct but it's TLEing for some cases, and I'm pretty sure I have the optimal logic, but it's either cuz Java is slow or something w/ the implementation of the code

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

»
6 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

I'm lazy to look at the code, even java, but you should solve this problem with graph coloring, it's classical. You should use 2 color and color this graph so that no adjacent vertices have the same color. Some time ago I got accepted in this problem with graph coloring.

»
6 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

prefer to use the iterative approach for cses problems. AC code in java https://ideone.com/K32kmB

»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by bobbilyking (previous revision, new revision, compare).