#include #include #include #include #include #include #include #include #include int max(int a,int b){ if(a>=b)return a; else return b; } void swap(int *a,int *b){ int tmp = *a; *a = *b; *b = tmp; } void babbleSort(int *data,int n){ for(int i=0;ii;j--){ if(data[j]>=data[j-1]){ swap(&data[j],&data[j-1]); } } } } using namespace std; /* cin.ignore(); getline(cin,dataStr); data = new int[n]; stringToInteger(&dataStr,data,n); */ void stringToInteger(string *str,int *data,int n){ for(int i=0;ifind(' ',0); data[i] = atoi(str->substr(0,spaceN).c_str()); str->erase(0,spaceN+1); } } int data[1500][1500][2];//data[i][j][k] i:iから jに向かう時の k:0コスト 1: 時間 int min1; int flag; void solve(int *s,int *t,int c,int n,int v,int now,int time1){ if(c<0)return; if(now==n){ if(min1>=time1){ min1=time1; flag=1; } } else if(now>n)return; else{ for(int i=0;i>n; cin>>c; cin>>v; min1=10000000; flag=0; int *s,*t,*y,*m; s = new int[v]; t = new int[v]; y = new int[v]; m = new int[v]; string str; cin.ignore(); getline(cin,str); stringToInteger(&str,s,v); getline(cin,str); stringToInteger(&str,t,v); getline(cin,str); stringToInteger(&str,y,v); getline(cin,str); stringToInteger(&str,m,v); vector *p; p = new vector [v]; for(int i=0;i