青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

posts - 74,  comments - 33,  trackbacks - 0
The Troublesome Frog
Time Limit: 5000MS Memory Limit: 100000K
Total Submissions: 3595 Accepted: 1058
Case Time Limit: 500MS

Description

In Korea, the naughtiness of the cheonggaeguri, a small frog, is legendary. This is a well-deserved reputation, because the frogs jump through your rice paddy at night, flattening rice plants. In the morning, after noting which plants have been flattened, you want to identify the path of the frog which did the most damage. A frog always jumps through the paddy in a straight line, with every hop the same length:

Your rice paddy has plants arranged on the intersection points of a grid as shown in Figure-1, and the troublesome frogs hop completely through your paddy, starting outside the paddy on one side and ending outside the paddy on the other side as shown in Figure-2:

Many frogs can jump through the paddy, hopping from rice plant to rice plant. Every hop lands on a plant and flattens it, as in Figure-3. Note that some plants may be landed on by more than one frog during the night. Of course, you can not see the lines showing the paths of the frogs or any of their hops outside of your paddy ?for the situation in Figure-3, what you can see is shown in Figure-4:

From Figure-4, you can reconstruct all the possible paths which the frogs may have followed across your paddy. You are only interested in frogs which have landed on at least 3 of your rice plants in their voyage through the paddy. Such a path is said to be a frog path. In this case, that means that the three paths shown in Figure-3 are frog paths (there are also other possible frog paths). The vertical path down column 1 might have been a frog path with hop length 4 except there are only 2 plants flattened so we are not interested; and the diagonal path including the plants on row 2 col. 3, row 3 col. 4, and row 6 col. 7 has three flat plants but there is no regular hop length which could have spaced the hops in this way while still landing on at least 3 plants, and hence it is not a frog path. Note also that along the line a frog path follows there may be additional flattened plants which do not need to be landed on by that path (see the plant at (2, 6) on the horizontal path across row 2 in Figure-4), and in fact some flattened plants may not be explained by any frog path at all.

Your task is to write a program to determine the maximum number of landings in any single frog path (where the maximum is taken over all possible frog paths). In Figure-4 the answer is 7, obtained from the frog path across row 6.

Input

Your program is to read from standard input. The first line contains two integers R and C, respectively the number of rows and columns in your rice paddy, 1 <= R,C <= 5000. The second line contains the single integer N, the number of flattened rice plants, 3 <= N <= 5000. Each of the remaining N lines contains two integers, the row number (1 <= row number <= R) and the column number (1 <= column number <= C) of a flattened rice plant, separated by one blank. Each flattened plant is only listed once.

Output

Your program is to write to standard output. The output contains one line with a single integer, the number of plants flattened along a frog path which did the most damage if there exists at least one frog path, otherwise, 0.

Sample Input

6 7
14
2 1
6 6
4 2
2 5
2 6
2 7
3 4
6 1
6 2
2 3
6 3
6 4
6 5
6 7

Sample Output

7
我第一次對(duì)自己的英持有懷疑態(tài)度。。。。一個(gè)半小時(shí)讀題,可能是在宿舍凈聽(tīng)魔獸的聲音了。。。。。。
靠,暈!
maybe something wrong with me,
I got ac with a time of 3.3s,but Others got ac with 700ms and 300k memory.
Faint.....
代碼巨丑,第一次用這么長(zhǎng)時(shí)間,排了倒數(shù)幾名
posted on 2009-01-08 20:44 KNIGHT 閱讀(299) 評(píng)論(1)  編輯 收藏 引用

FeedBack:
# re: The Troublesome Frog
2009-01-08 22:32 | Knight
我暈,一個(gè)晚上居然沒(méi)調(diào)出來(lái)。。。。。
讀題還少了條件。。。。。
現(xiàn)在可好了還是超時(shí)的東西。。。。  回復(fù)  更多評(píng)論
  

只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問(wèn)   Chat2DB   管理


<2009年1月>
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567

常用鏈接

留言簿(8)

隨筆檔案

文章檔案

Friends

OJ

搜索

  •  

最新評(píng)論

閱讀排行榜

評(píng)論排行榜

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            亚洲一区二区在线免费观看| 亚洲日韩欧美视频一区| 久久精品99国产精品酒店日本| 亚洲第一成人在线| 免费观看成人鲁鲁鲁鲁鲁视频| 久久久精品五月天| 欧美高清自拍一区| 日韩视频免费| 欧美在线观看你懂的| 久久久久一区二区| 欧美激情国产精品| 国产精品国产三级国产专播品爱网| 国产精品高潮呻吟视频| 国内自拍一区| 一区二区三区视频在线播放| 亚洲欧美日韩中文视频| 久久精品人人爽| 欧美黄色片免费观看| 一区二区三区精密机械公司 | 日韩视频在线播放| 亚洲欧美日韩中文在线制服| 久久精品成人| 欧美激情一区| 国产区在线观看成人精品| 1024日韩| 欧美一区二区三区免费视频| 蜜桃av一区二区| 亚洲理伦在线| 久久精品99久久香蕉国产色戒| 欧美精品成人91久久久久久久| 欧美私人啪啪vps| 亚洲高清不卡| 欧美一区二区成人6969| 最新亚洲一区| 99re国产精品| 亚欧美中日韩视频| 欧美va天堂| 午夜精品久久久久久久久久久| 亚洲永久在线| 欧美二区在线播放| 性欧美超级视频| 欧美日韩一区二区三区在线看| 狠狠色丁香婷婷综合| 亚洲欧美日韩综合一区| 亚洲人成在线观看一区二区| 亚洲一区网站| 欧美视频在线观看视频极品 | 国产日韩在线不卡| 亚洲在线成人精品| 亚洲人体影院| 欧美不卡一卡二卡免费版| 国内成+人亚洲| 欧美一区中文字幕| 亚洲综合三区| 欧美日韩精品久久| 亚洲老司机av| 欧美激情亚洲国产| 欧美 日韩 国产在线| 国产一区二区三区在线观看精品 | 欧美日韩免费精品| 亚洲精品中文字幕有码专区| 欧美v日韩v国产v| 久久久精品一区| 伊人久久大香线蕉av超碰演员| 久久日韩粉嫩一区二区三区| 欧美一区二区视频在线观看| 国产偷久久久精品专区| 久久久噜噜噜久久人人看| 欧美在线一二三区| 1000部国产精品成人观看| 欧美福利视频在线| 欧美韩日一区| 亚洲自拍高清| 久久激情综合网| 亚洲福利视频一区| 亚洲国产va精品久久久不卡综合| 欧美1区2区3区| 99精品热视频只有精品10| 在线视频免费在线观看一区二区| 欧美三级在线视频| 亚洲欧美日韩另类精品一区二区三区| 亚洲一级片在线观看| 国产一区二区视频在线观看| 久久亚洲精品伦理| 欧美护士18xxxxhd| 欧美福利在线观看| 亚洲男人的天堂在线观看| 欧美在线免费播放| 日韩午夜精品视频| 午夜精品一区二区三区在线| 巨乳诱惑日韩免费av| 欧美α欧美αv大片| 欧美成人免费小视频| 正在播放亚洲一区| 欧美一区综合| 日韩视频在线免费| 亚洲欧美资源在线| 亚洲国产高清一区二区三区| 99国产精品国产精品毛片| 国产一区二区三区在线观看网站| 亚洲第一主播视频| 国产日韩欧美精品| 亚洲精品免费网站| 国产女主播在线一区二区| 亚洲国产精品久久久久婷婷老年 | 国产一区二区三区在线观看视频| 欧美成人精品在线观看| 欧美日韩在线另类| 欧美1级日本1级| 国产精品一区亚洲| 欧美激情一区二区三区在线| 国产美女高潮久久白浆| 91久久精品国产91性色| 国产视频观看一区| 一区二区三区四区五区精品视频| 精品电影一区| 亚洲欧美日韩在线综合| 夜夜嗨av一区二区三区四季av| 久久精品国内一区二区三区| 中国日韩欧美久久久久久久久| 久久伊人精品天天| 久久噜噜噜精品国产亚洲综合| 国产精品99一区| 亚洲毛片av在线| 亚洲精品乱码久久久久久| 久久九九精品99国产精品| 亚洲永久免费av| 欧美人成网站| 欧美国产1区2区| 1024亚洲| 久久影院午夜论| 蜜桃av一区二区| 在线电影一区| 久久免费高清视频| 蜜臀av在线播放一区二区三区| 国产免费成人在线视频| 日韩亚洲欧美一区| 99国产欧美久久久精品| 欧美韩国日本一区| 亚洲人成7777| 99国产精品一区| 欧美日韩国产va另类| 91久久中文字幕| 99re国产精品| 欧美日韩亚洲一区| 中文亚洲免费| 欧美一级视频| 国产一区二区丝袜高跟鞋图片| 亚洲女优在线| 久久综合狠狠综合久久综合88 | 久久久久国产精品午夜一区| 欧美黄在线观看| 国产在线精品成人一区二区三区| 亚洲免费伊人电影在线观看av| 欧美亚洲一区二区在线观看| 国产欧美亚洲一区| 欧美一区二区三区婷婷月色 | 欧美电影免费网站| 亚洲精品亚洲人成人网| 亚洲一区二区免费在线| 国产精品护士白丝一区av| 欧美亚洲免费| 亚洲成色精品| 99国产精品久久久久久久成人热 | 国产精品99久久99久久久二8 | 亚洲福利视频三区| 亚洲一区二区在线免费观看| 国产精品美女久久久浪潮软件| 欧美在线精品一区| 91久久在线视频| 久久精品国产在热久久| 亚洲精品国产精品国自产在线| 欧美三级精品| 久久av红桃一区二区小说| 亚洲国产精品久久久| 久久国产加勒比精品无码| 91久久亚洲| 国产欧美亚洲视频| 欧美理论片在线观看| 亚洲欧美在线免费观看| 亚洲国产精品久久久久婷婷老年 | 亚洲国产精品久久久| 国产精品成人一区二区三区吃奶 | 国产日韩欧美中文在线播放| 久久午夜电影网| av不卡在线观看| 老司机精品久久| 亚洲免费人成在线视频观看| 亚洲福利av| 国产亚洲欧美日韩在线一区| 欧美区日韩区| 欧美1区3d| 性做久久久久久久久| 正在播放欧美一区| 久久久国产成人精品| 亚洲一区二区在线视频| 亚洲裸体在线观看| 亚洲国产精品国自产拍av秋霞| 久久国产精品久久w女人spa| 一区二区三区高清在线|