# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
787978 | allin27x | 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 <bits/stdc++.h>
using namespace std;
int ds[2][(int)1e5];
unordered_map<int,int> adj[(int)1e5];
int vis[(int)1e5];
int ind = 0;
unordered_set<int> sets[(int)1e5];
int cp[(int)1e5];
void dfs(int i , int p, int len, int x){
sets[ind].insert(i);
vis[i] = 1;
ds[x][i] = len;
for (auto const &pair: adj[i]){
int c = pair.first; int w= pair.second;
if (c==p) continue;
dfs(c,i, len+w,x);
}
}
int travelTime(int N, int M, int L, int A[], int B[], int T[]){
for (int i=0; i<M; i++){
int a = A[i]; int b = B[i];
adj[a][b] = T[i]; adj[b][a] = T[i];
}
for (int i=0; i<N; i++){
if (vis[i]) continue;