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 120106701 at 2016-09-14 14:23:20 on Problem 3592
In Reply To:传送的位置有问题! Posted by:55226 at 2014-10-22 07:48:30
没这回事!我代码AC了,但是不用考虑传送到地图外的点

核心建图如下
void add(rec x,rec y){
	mp[m1].x=x.id,mp[m1].y=y.id;
	mp[m1].next=h[x.id];
	h[x.id]=m1++;
}


for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				char c;
				scanf("%c",&c);
				if(c>='0' && c<='9'){
					map[i][j][0]=c-'0';
					map[i][j][1]=++n1;
					node[n1].x=i,node[n1].y=j;
					node[n1].id=n1,node[n1].v=c-'0';
				}
				else if(c=='#')
					map[i][j][0]=-1;
				else if(c=='*'){
					map[i][j][0]=0;
					map[i][j][1]=++n1;
					node[n1].x=i,node[n1].y=j;
					node[n1].id=n1,node[n1].v=0;
					K[++k]=n1;
				}
			}
			scanf("\n");
		}
		memset(h,0xff,sizeof(h));
		for(int i=0;i<n;i++)
			for(int j=0;j<m;j++)	
				if(map[i][j][0]>=0){
					if(map[i+1][j][0]>=0 && i+1<n)
						add(node[map[i][j][1]],node[map[i+1][j][1]]);
					if(map[i][j+1][0]>=0 && j+1<m)
						add(node[map[i][j][1]],node[map[i][j+1][1]]);	
				}
		for(int i=1;i<=k;i++){
			int x1,y1;
			scanf("%d%d",&x1,&y1);
			if(map[x1][y1][0]>=0)
				add(node[K[i]],node[map[x1+y1/10][y1%10][1]]);
		}

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