题意:有一个人要去旅游,他想要逛遍所有的城市,但是同一个城市又不想逛超过2次。现在给出城市之间的来往路费,他可以选择任意一个点为起点。 问逛遍所有城市的最低路费是多少。 析:用三进制表示每个城市的访问次数,然后 bfs 进行遍历,不过要注意这个题卡内存,必须要去年一些无用的状态,要不然会超内存的,还 ...
分类:
其他好文 时间:
2017-06-29 00:53:30
阅读次数:
199
[luogu1535]游荡的奶牛 题目描述 Searching for the very best grass, the cows are travelling about the pasture which is represented as a grid with N rows and M co ...
分类:
其他好文 时间:
2017-06-07 21:44:06
阅读次数:
223
被某题卡SB了,结果这题也没读好。。。以为每一个格子能够有负数就当搜索做了。怎么想也搜只是去,后来发现每一个格子是非负数,那么肯定就是构造题。 题解例如以下: 首先假设nn为奇数或者mm为奇数,那么显然能够遍历整个棋盘。 如果n,mn,m都为偶数,那么讲棋盘黑白染色,如果(1,1)(1,1)和(n, ...
分类:
其他好文 时间:
2017-06-04 12:51:45
阅读次数:
179
题意:从一个方格的左上角走到右下角,拿起经过的全部数字,且每一个方格最多仅仅能走一次,问,终于到达右下角时,sum最大是多少。 做法:……非常显然构造了 首先假设nn为奇数或者mm为奇数,那么显然能够遍历整个棋盘。 如果n,mn,m都为偶数,那么将棋盘黑白染色,如果(1,1)(1,1)和(n,m)( ...
分类:
其他好文 时间:
2017-05-27 20:45:19
阅读次数:
145
行数或列数为奇数就能够所有走完. 行数和列数都是偶数,能够选择空出一个(x+y)为奇数的点. 假设要空出一个(x+y)为偶数的点,则必须空出其它(x+y)为奇数的点 Travelling Salesman Problem Time Limit: 3000/1500 MS (Java/Others) ...
分类:
其他好文 时间:
2017-05-24 18:33:15
阅读次数:
160
Problem Description Teacher Mai is in a maze with n rows and m columns. There is a non-negative number in each cell. Teacher Mai wants to walk from th ...
分类:
其他好文 时间:
2017-05-14 18:50:08
阅读次数:
252
Problem Description Mr. West bought a new car! So he is travelling around the city.One day he comes to a vertical corner. The street he is currently i ...
分类:
其他好文 时间:
2017-05-06 11:46:35
阅读次数:
198
Problem Description Mr. West bought a new car! So he is travelling around the city.One day he comes to a vertical corner. The street he is currently i ...
分类:
其他好文 时间:
2017-05-05 19:56:36
阅读次数:
219
Travelling Tours Time limit: 1.0 secondMemory limit: 64 MB There are N cities numbered from 1 to N (1 ≤ N ≤ 200) and M two-way roads connect them. The ...
分类:
其他好文 时间:
2016-10-25 19:20:42
阅读次数:
247
A ZS the Coder and Chris the Baboon are travelling to Udayland! To get there, they have to get on the special IOI bus. The IOI bus has nrows of seats. ...
分类:
其他好文 时间:
2016-08-30 22:43:21
阅读次数:
398