Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
TLE的进来经过本人孜孜不倦的尝试 把两个矩阵相乘的部分 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator