Submission #601361

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
6013612022-07-21 18:29:42narvaloFerries (NOI13_ferries)C++17
28 / 40
147 ms30164 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int INF = (int)1e18;
int ferries(int n , int m , vector<int> a , vector<int> b , vector<int> c) {
vector<vector<pair<int , int>>> adj(n);
for (int i = 0 ; i < m ; i++) {
a[i] -= 1 , b[i] -= 1;
adj[a[i]].emplace_back(b[i] , c[i]);
}
vector<int> dp(n , -1) , vis(n);
function<long long(int)> Solve = [&](int node) -> long long {
if (node == n - 1) {
return 0;
}
if (vis[node] == 1) {
return -1;
}
if (dp[node] != -1) {
return dp[node];
}
vis[node] = 1;
vector<int> d , s;
for (auto x : adj[node]) {
int g = Solve(x.first);
if (g != -1) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...