# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
900566 | JakobZorz | Dreaming (IOI13_dreaming) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include"dreaming.h"
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
typedef long long ll;
vector<pair<ll,ll>>nodes[100000];
bool vis[100000];
vector<ll>node_list;
void dfs(ll node){
if(vis[node])
return;
vis[node]=true;
node_list.push_back(node);
for(auto ne:nodes[node])
dfs(ne.first);
}
map<pair<ll,ll>,ll>dp;
ll get_max_dist(ll node,ll prev){
if(dp.count({node,prev}))
return dp[{node,prev}];
ll res=0;
for(auto ne:nodes[node]){
if(ne.first==prev)
continue;