Please, try EDU on Codeforces! New educational section with videos, subtitles, texts, and problems. ×

Light71192's blog

By Light71192, history, 16 months ago, In English,

I am getting wrong answer (on test 15) for this problem : 687A - NP-Hard Problem

Here is my code : 51436363

Solution description : I have used concept of bipartitie graphs. If the graph is a bipartitie graph then solution is possible otherwise not. I have made a vector "dist" in which i have stored the distance of vertices from the source vertex. All the vertices at "odd" distance from the source go to vector "v2" and those with "even" distance go to vector "v1".

I have just started to learn graph theory so please tell me what is wrong with the logic and code.

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

16 months ago, # |
  Vote: I like it 0 Vote: I do not like it

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

16 months ago, # |
  Vote: I like it +4 Vote: I do not like it

I have recently solved this problem . You are considering the graph as connected but that is not mentioned anywhere. Here is my code 51418664