#include #include ifstream file("centauri.in"); int main() { int n,m,xx=0; int idleTime[30]; int robopos[30]; int roboweight[30]; file >> n; file >> m; int maxWeight = 0; while(n+m!=0) { int i,j,k; for(i=0; i> roboweight[i]; if(roboweight[i]>=maxWeight) maxWeight = roboweight[i]; } int a,b,c,d; int maxTime = 0; int awt = 0; int dist,minDist,bwt=0,bwtc=0; // *************************** Simulation file >> a; int firstTime = a; maxTime = a; int awtc = 0; for(i=0; i> b; file >> c; file >> d; while(a!=-1) { int iTime = 0; // finding robot, doing TimeStep int minStartTime=maxTime+n+1; int dist; int minWeight = maxWeight+1; int time; int selected = 0; for(i=0; i=d) { time = idleTime[i]; if(idleTime[i]<=a) time = a; dist = (b-robopos[i]+n)%n; // cout << "robot " << i << ":" << idleTime[i] << " " << time << " " << dist << endl; if(time < minStartTime) { minStartTime = time; minWeight = roboweight[i]; selected = i; minDist = dist; } else if(time == minStartTime) { if(dist < minDist ) { minWeight = roboweight[i]; minDist = dist; selected = i; } } } } i=selected; if(a>=idleTime[i]) awt+=a-idleTime[i]; awtc++; // cout << "robot = " << i << endl; idleTime[i] = minStartTime+10+(c-b+n)%n+minDist; bwt+=idleTime[i]-a; bwtc++; // cout << idleTime[i] << endl; if(maxTime> a; file >> b; file >> c; file >> d; } for(i=0; i> n; file >> m; } }