Help with the approach and code in C++. Thanks I have tried Dijkstra by make every edge weights to -1. But I am not able to print the longest path.
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3839 |
3 | Radewoosh | 3646 |
4 | jqdai0815 | 3620 |
4 | Benq | 3620 |
6 | orzdevinwang | 3612 |
7 | Geothermal | 3569 |
7 | cnnfls_csy | 3569 |
9 | ecnerwala | 3494 |
10 | Um_nik | 3396 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | Um_nik | 164 |
2 | maomao90 | 160 |
3 | -is-this-fft- | 159 |
4 | atcoder_official | 158 |
4 | cry | 158 |
4 | awoo | 158 |
7 | adamant | 155 |
8 | nor | 154 |
9 | TheScrasse | 153 |
10 | maroonrk | 152 |
Help with the approach and code in C++. Thanks I have tried Dijkstra by make every edge weights to -1. But I am not able to print the longest path.
Hi, I was going through the solutions for this question Mike and Distributions and wrote this ->Solution<- using some hints from some others solution.
Help me, I can't figure out why this solution even passes as it would have given TLE. Thanks in advance.
I can't understand the solutions of Query on trees https://www.codechef.com/COMA2020/problems/QUERYT . Help me with the concept and Solution.
Question: You are given a tree with N nodes and N−1 edges. The nodes are numbered from 1 to N and the tree is rooted at 1.
Every node has a value associated with it.
If we consider the simple path between two nodes u and v , then a node in this path is called special if it's value is not coprime with the value of lca(u,v). Here lca(u,v) means the lowest common ancestor of u and v.
You will be given Q queries. Every query contains two integers denoting two nodes,u and v. You have to find the count of special nodes in the simple path between u and v.
Название |
---|