This problem came on TCS mockvita 2018.Here is a link to problem — https://www.programminggeek.in/2018/07/mockvita-2018-problem-heights-of.html?m=1

Any idea how to solve this?

# | User | Rating |
---|---|---|

1 | tourist | 3539 |

2 | V--o_o--V | 3338 |

3 | Um_nik | 3307 |

4 | Petr | 3297 |

5 | ecnerwala | 3282 |

6 | LHiC | 3266 |

7 | wxhtxdy | 3264 |

8 | Radewoosh | 3257 |

9 | Vn_nV | 3182 |

10 | dotorya | 3178 |

# | User | Contrib. |
---|---|---|

1 | Radewoosh | 207 |

2 | Errichto | 177 |

3 | neal | 159 |

4 | Ashishgup | 158 |

5 | PikMike | 157 |

6 | majk | 156 |

6 | Petr | 156 |

8 | rng_58 | 155 |

9 | Um_nik | 154 |

10 | 300iq | 153 |

This problem came on TCS mockvita 2018.Here is a link to problem — https://www.programminggeek.in/2018/07/mockvita-2018-problem-heights-of.html?m=1

Any idea how to solve this?

↑

↓

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jan/24/2019 12:50:36 (d3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

Great approach. I thought one topological sort will work after adding all the edges. But your approach looks like to be correct.