ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Common Board

is my algorithm right? problem 1022
Posted by Ivan Kokan 24 Aug 2005 01:19
 i'm using method of giving points to each person, so that every child has more points than his father. i'm doing that with bfs:

if points[child] <= points[parent]
points[child] = points[parent] + 1;
bfs (child);

i think method is right.

i know about topological sort, but i'm interested is my idea ok. (my code fails on test case #5).
Re: is my algorithm right? problem 1022
Posted by ACM.Krupko_Victor[Ivanovo SPU] 24 Aug 2005 02:03
Try my algorithm:

You find the person at which there are no parents. Remove him. You delete him.

And all this in a cycle.
Re: is my algorithm right? problem 1022
Posted by Ivan Kokan 24 Aug 2005 02:48
 i know about that. that's topological sort. i'm only trying to figure out if my algorithm is correct. that's all.
:) :(
Posted by ACM.Krupko_Victor[Ivanovo SPU] 24 Aug 2005 02:53
If at you wa5 as your algorithm can be correct.:)
I simply wanted to help.
Re: :) :(
Posted by Ivan Kokan 25 Aug 2005 20:13
 i don't understand your post.

 also, i haven't got any comment about my problem yet.