Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:新的数据必须接在当前右端最值最小的组后面吗In Reply To:新的数据必须接在当前右端最值最小的组后面吗 Posted by:JenningsMao at 2017-11-22 21:22:14 有些情况下是有多个答案的,我的做法就是将 时间段左端排序之后,依次向已有分组后面追加,但是并不一定是追加到右端值最小的队列后,我觉得也没有什么问题啊 有人能和我说下原因么... for (int i = 0; i < n; ++i){ for (int j = 0; j < MAX_COWS; ++j){ if (stall_end[j] < cows[i].start){ stall_end[j] = cows[i].end; // 找到一个合适的就追加 stall[cows[i].id] = j+1; break; } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator