Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include <stdio.h>#include <string.h>struct Edge{int value, to, next;} edge[200001];int head[10001], limited[10001], k, t, n, m, minw = 1000000, maxw = 0;bool dfs(int pos, int count, int w){if (pos == t)return true;if (limited[pos] + count >= k)return false;limited[pos] = k - count;++count;for (int i = head[pos]; i > 0; i = edge[i].next)if (edge[i].value <= w && (limited[edge[i].to] + count <= k) \&& dfs(edge[i].to, count, w))return true;return false;}int main(){int cnt = 1, from, to, w;scanf("%d%d%d%d", &n, &m, &k, &t);++n;for (int i = 0; i < m; ++i){