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 lx865712528 at 2014-05-26 22:51:04 on Problem 2888
In Reply To:TLE的进来 Posted by:tank2game at 2013-07-24 17:20:15
> 经过本人孜孜不倦的尝试
> 把两个矩阵相乘的部分
> for(int i=0;i<m;i++)
> 		for(int j=0;j<m;j++){
> 			C.A[i][j]=0;
> 			for(int k=0;k<m;k++)
> 				C.A[i][j]=(C.A[i][j]+A.A[i][k]*B.A[k][j])%mod;
> 		}
> 改成
> for(int i=0;i<m;i++)
> 		for(int j=0;j<m;j++){
> 			C.A[i][j]=0;
> 			for(int k=0;k<m;k++)
> 				C.A[i][j]=(C.A[i][j]+A.A[i][k]*B.A[k][j]);
> 			C.A[i][j]%=mod;
> 		}
> 立马从TlE到486ms。。。。

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