///combax #include #include #include #include using namespace std; bool hasbetter(set > s,pair c ){ for(set >::iterator it= s.begin();it!=s.end();it++){ if(it->first<=c.first && it->second>=c.second) return true; } return false; } double best(set > s){ double ret=12345678956; for(set >::iterator it= s.begin();it!=s.end();it++){ ret= min((it->first / (double)(it->second+0.00000001)),ret); } return ret; } int main() { ifstream cin("ski.txt"); int cases; cin>>cases; for(;cases--;){ int n,r,sta,end; cin >> n >> r >> sta >> end; int i; int cost[102][102]={0},dist[102][102]={0}; for(int i=0;i> s >> e >> spd >> d; dist[s-1][e-1]=d; cost[s-1][e-1]=((s<=60)? (d*(70-spd)) : (d*(spd-50))); } set > > q; set > cand[100]; q.insert(make_pair(sta-1,make_pair(0,0))); while(!q.empty()){ pair > p = *q.begin(); q.erase(q.begin()); if (hasbetter(cand[n],p.second)) continue; int h=p.first,c=p.second.first,d=p.second.second; // cout << h << " " << c << " " << d << endl; cand[h].insert (p.second); for(int k=0;k