Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:新的数据必须接在当前右端最值最小的组后面吗

Posted by JenningsMao at 2017-11-22 21:24:57 on Problem 3190
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator