USACO 3.2 Magic Squares题解
时间:2011-01-21 来源:瀑布飞鹰
Compiling...
Compile: OK
Executing...
Test 1: TEST OK [0.022 secs, 7836 KB]
Test 2: TEST OK [0.011 secs, 7836 KB]
Test 3: TEST OK [0.011 secs, 7832 KB]
Test 4: TEST OK [0.011 secs, 7832 KB]
Test 5: TEST OK [0.022 secs, 7836 KB]
Test 6: TEST OK [0.043 secs, 7836 KB]
Test 7: TEST OK [0.065 secs, 7836 KB]
Test 8: TEST OK [0.097 secs, 7840 KB]
All tests OK.
Your program ('msquare') produced all correct answers! This is your
submission #22 for this problem. Congratulations!
Here are the test data inputs:
------- test 1 ------- 2 6 8 4 5 7 3 1 ------- test 2 ------- 1 2 3 4 5 6 7 8 ------- test 3 ------- 6 7 4 1 8 5 2 3 ------- test 4 ------- 5 1 2 4 3 7 8 6 ------- test 5 ------- 6 1 5 4 3 2 7 8 ------- test 6 ------- 4 1 2 3 5 8 7 6 ------- test 7 ------- 3 4 2 1 5 6 7 8 ------- test 8 ------- 4 3 1 2 5 6 7 8Keep up the good work!
Thanks for your submission!
看到这段文字我终于激动了......提交22次....
问题1:
开始看错题,以为是把给出的状态转换为12345678的状态。。。。
问题2:
宽搜队列开小了。。。致命伤啊,以至于每测一组数据我加大一次数组范围......TT
此题关键在于如何判断状态的重复,使用康托展开即可
然后就是宽搜,没什么诀窍,仔细仔细就能过了
队列开到50000即可。。。。。。(想起这个事情就泪奔......)