http://orac.amt.edu.au/fario/11/problems_en.pdf fourth problem
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 151 |
http://orac.amt.edu.au/fario/11/problems_en.pdf fourth problem
Name |
---|
It looks like a usual dp on a tree. I think you should write a comparator, like 'What vertex we should go into?'. Then run DFS, and at each step sort all children of the current vertex by this comparator and visit them in this exact order. Once you visit a subtree, it becomes a vertex with its own parameters.
I may be wrong, but it's the first solution I would think of.
i will write comparator but which priority? i have no idea
Write the mathematical expression, what number of citizen will be dead if we go to the first city and then to the second. Then write the same expression if you visit the cities in the opposite order. Sign of the difference of these values will show which city of these two should be visited first.
i try this but i can't, i will try this once again
my code is here and i dont know is it true solution
define fi first
define se second
define SIZE(A) ((int)A.size())
define pb push_back
using namespace std;
const int MAXN = 100010;
typedef pair<int,int> ii;
vector way[MAXN];
int n;
long long vic[MAXN];
struct node{
}ar[MAXN];
typedef set::iterator sit;
set G[MAXN];
bool used[MAXN];
node rec(int k,int t){
}
long long f(int k){
}
int main(){
}
my bug is "set", it will be "multiset". thanks dalex
Use vectors + sorting next time, it should be a bit faster than sets with their red-black trees.
AppleZ the previous comment for my wrong idea. Thanks
Sorry...