ytqkoala / aoapc-book

Automatically exported from code.google.com/p/aoapc-book
0 stars 0 forks source link

P383例1(UVa 11270)程序TLE, P385有个笔误 #12

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
时限只有1s, 不知道是服务器过慢还是时限改小了... 

标程没有考虑一些可以直接计算的情况:
1. m, n同时为偶数无解.
2. mn = 0, 无解.
3. m=1, n为偶数仅有一解.

而且数据中似乎存在大量重复, 个人以为应该预处理(m,n)为(2, 
50), (3, 33), (4, 25), ... ,(9, 11), (10,10)的情况, 可以得到诸如(2,2), 
(2,3), ... ,(2,49)的结果, 记录后直接输出即可.
加上上述优化可以在0.03s左右AC. :)
---------------------------------
另外P385 update函数中:
if(TEST(m,b)) d[cur][CLEAR(m,b)] += d[1-cur][a];
TEST函数和CLEAR函数中m, b的顺序和前文的描述不符, 应改为
if(TEST(b,m)) d[cur][CLEAR(b,m)] += d[1-cur][a];

Original issue reported on code.google.com by LiuYu...@gmail.com on 13 Mar 2013 at 9:38

GoogleCodeExporter commented 8 years ago
哈,谢谢!那个代码是很久以前写的,当时可能没有那些冗��
�数据。我会尽快修改代码仓库。

Original comment by rujia....@gmail.com on 14 Mar 2013 at 4:53

GoogleCodeExporter commented 8 years ago
m,n同为奇数无解

Original comment by pyxpyx1992 on 23 Mar 2013 at 5:48

GoogleCodeExporter commented 8 years ago
加入了缓存。其他优化我觉得和那题的写作意图无关,就不��
�了,呵呵

Original comment by rujia....@gmail.com on 23 Mar 2013 at 6:57