#include #include #include #include #include #include #include #include using namespace std; class comp { public: pair pt; int runnerId; }; class runner { public: pair firstPt; pair lastPt; double skorost; double maxTime; long long maxDst; int id; }; FILE* in; FILE* out; int n, k; long long area; long long totalSkorost; runner runners[100001]; comp comps[100001]; string result_comps=""; long long getMaxDst(double skorost){ return ceil((sqrt(area)*skorost/totalSkorost)*100.0)/100; } long long getDst(pairpt1, pairpt2){ return ceil((sqrt((pt1.first - pt2.first)*(pt1.first - pt2.first) + (pt1.second - pt2.second)*(pt1.second - pt2.second)))*100.0)/100; } int main() { ///in =stdin; ///out =stdout; in =fopen("runners.in","rt"); out =fopen("runners.out","wt"); fscanf(in,"%d %d\n",&n, &k); ios_base::sync_with_stdio(false); cin.tie(NULL); const clock_t TIME_LIMIT = (clock_t) (4.5* CLOCKS_PER_SEC); clock_t BEGIN_TIME; BEGIN_TIME = clock(); int maxScorost=0,maxScorostNum; for (int i=0; i maxScorost){ maxScorost = runners[i].skorost; maxScorostNum = i; } totalSkorost += runners[i].skorost; } int x1=0,y1=0,x0=INT_MAX,y0=INT_MAX; for (int i=0; i curr; fscanf(in,"%d %d",&curr.first, &curr.second); if(curr.firstx1){ x1=curr.first; } if(curr.secondy1){ y1=curr.second; } comps[i].pt=curr; comps[i].runnerId = -1; } area=(x1-x0)*(y1-y0); int lastComp; int lastRunner=-1; ////// ///// for (int i=0; iTIME_LIMIT)break; } if(minTm<=runners[comps[i].runnerId-1].maxTime){ result_comps+=to_string(comps[i].runnerId)+"\n"; runners[comps[i].runnerId-1].lastPt=comps[i].pt; found = true; } if(!found && lastRunnerTIME_LIMIT){ break; } } for(int i=lastRunner+1; iTIME_LIMIT)break; } if(comps[i].runnerId>0) runners[comps[i].runnerId-1].lastPt=comps[i].pt; //else // comps[i].runnerId=maxScorostNum+1; result_comps+=to_string(comps[i].runnerId)+"\n"; if(clock()-BEGIN_TIME>TIME_LIMIT)break; } for(int i=lastRunner+1; i0){ result_comps+=to_string(comps[i].runnerId)+"\n"; } else{ result_comps+=to_string(maxScorostNum+1)+"\n"; } } fprintf(out,"%s",result_comps.c_str()); return 0; }