# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
299448 | 2020-09-14T23:06:52 Z | APROHACK | Shortcut (IOI16_shortcut) | C++14 | 0 ms | 0 KB |
#include <bits/stdc++.h> #define PB push_back #define MP make_pair #define F first #define S second using namespace std; vector<pair<long long, long long> >g[1000000];//desde hasta peso //long long dist[501][501]; bool recorridos[1000000]; long long dp(long long pos, long long hasta){ if(pos==hasta)return 0; recorridos[pos]=true; long long ret=LLONG_MAX/3, tam=g[pos].size(); for(long long i = 0 ; i < tam ; i++){ if(!recorridos[g[pos][i].F])ret=min(ret, dp(g[pos][i].F, hasta)+g[pos][i].S); } recorridos[pos]=false; return ret; }