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
北京大学《ACM/ICPC大学生程序设计竞赛训练》暑期课面向全球招生!

我这么写有错吗? ;-(

Posted by huangwei at 2008-07-21 15:54:30 on Problem 2286
状态是 2^24
以1,2,3分别作为中间环的可能值,同则为1,不同为0
1 1 1 1 3 2 3 2 3 1 3 2 2 3 1 2 2 2 3 1 2 1 3 3
起始三个状态为:
1 1 1 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 1 0 0
0 0 0 0 0 1 0 1 0 0 0 1 1 0 0 1 1 1 0 0 1 0 0 0
0 0 0 0 1 0 1 0 1 0 1 0 0 1 0 0 0 0 1 0 0 0 1 1

在状态hash时,state是状态,path是操作序列
bool make_hash()
{
	if (hash[state] == -1 || hash[state]>path)
	{
		hash[state] = path;
		return true;
	}
	return false;
}
这样我用A*可以过的

但是我在优先队列这样写就WA了
while (! pq.empty())
{
	NODE now = pq.top();
	pq.pop();
	// 加了下面2句就WA
	if (hash[now.state] < now.path)
		continue;
	....
}
请教大牛们~~~~
竟然hash时都可以那样的判断,问什么在外部加这个就WA了,~~~~郁闷

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