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

囧……谁能告诉我建图时为什么K到C只能建成单向边?

Posted by Ever_ljq at 2011-04-20 21:41:29 on Problem 2112 and last updated at 2011-04-20 21:44:03
void make_graph()
{
	for (int i = 1; i <= K + C; i++)
		for (int j = 1; j <= K + C; j++)
			if (adj[i][j] <= ans) f[i][j] = 1;
                           else f[i][j] = 0;
	for (int i = 1; i <= K; i++) f[i][t] = M, f[t][i] = 0;
	for (int i = K + 1; i <= K + C; i++) f[s][i] = 1, f[i][s] = 0;
}
这样就WA了……
void make_graph()
{
	memset(f, 0, sizeof(f));
	for (int i = K + 1; i <= K + C; i++)
		for (int j = 1; j <= K; j++)
			if (adj[i][j] <= ans) f[i][j] = 1;
	for (int i = 1; i <= K; i++) f[i][t] = M;
	for (int i = K + 1; i <= K + C; i++) f[s][i] = 1;
}
这样就AC了……

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