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

TLE的进来

Posted by tank2game at 2013-07-24 17:20:15 on Problem 2888
经过本人孜孜不倦的尝试
把两个矩阵相乘的部分
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