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:不就是矩阵乘法么...为什么TLE...谁贡献一个大数据吧

Posted by majia5 at 2009-05-17 14:33:06 on Problem 3735 and last updated at 2009-05-17 14:33:44
In Reply To:不就是矩阵乘法么...为什么TLE...谁贡献一个大数据吧 Posted by:Ikki at 2009-05-17 14:18:46
乘法的时候
if(mata[i][k]&&matb[k][j])
  matc[i][j]+=mata[i][k]*mat[k][j];
加了就可以过了
至于原因,是因为构造出来的矩阵中0很多,这样可以避免乘法次数过多
还有就是构造系数的时候需要使用O(n^2)来构造..

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