#include #include typedef struct{ int to; int time; int cost; } path; using namespace std; int start,target; int best_cost=2147483647; int time_limit; int m,n; vector graph[66000]; bool visited[66000]={0}; void dfs(short from,int time,int cost){ visited[from]=true; for(auto i=graph[from].begin();ito==target){ if(time+i->time<=time_limit&&cost+i->costcost; } continue; } else if(time+i->time>time_limit||cost+i->cost>best_cost||visited[i->to]==true){ continue; } dfs(i->to,time+i->time,cost+i->cost); } visited[from]=false; return; } int main(){ int from,to,time,cost; scanf("%d%d",&n,&m); for(int i=0;i