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

简单解题报告……

Posted by xuhaoran510 at 2011-05-23 21:57:00 on Problem 3734
这题如果不考虑超时的问题,直接用dp做,怎么做?
如果用{a,b,c,d}表示给i个格子染色的情况,四个值分别为:目标颜色两个偶数,一偶一奇,一奇一偶,两个奇的方案数。
则给第i+1个格子染色后的状态为{2a+b+c,a+2b+d,a+2c+d,b+c+2d}
于是很容易联想到矩乘……
设计矩阵:
2 1 1 0
1 2 0 1
1 0 2 1
0 1 1 2

然后快速幂即可……a11即为答案

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