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

posts - 74,  comments - 33,  trackbacks - 0

Description

The cows have revised their game of leapcow. They now play in the middle of a huge pasture upon which they have marked a grid that bears a remarkable resemblance to a chessboard of N rows and N columns (3 <= N <= 365).

Here's how they set up the board for the new leapcow game:

* First, the cows obtain N x N squares of paper. They write the integers from 1 through N x N, one number on each piece of paper.

* Second, the 'number cow' places the papers on the N x N squares in an order of her choosing.

Each of the remaining cows then tries to maximize her score in the game.

* First, she chooses a starting square and notes its number.

* Then, she makes a 'knight' move (like the knight on a chess board) to a square with a higher number. If she's particularly strong, she leaps to the that square; otherwise she walks.

* She continues to make 'knight' moves to higher numbered squares until no more moves are possible.

Each square visited by the 'knight' earns the competitor a single point. The cow with the most points wins the game.

Help the cows figure out the best possible way to play the game.

Input

* Line 1: A single integer: the size of the board

* Lines 2.. ...: These lines contain space-separated integers that tell the contents of the chessboard. The first set of lines (starting at the second line of the input file) represents the first row on the chessboard; the next set of lines represents the next row, and so on. To keep the input lines of reasonable length, when N > 15, a row is broken into successive lines of 15 numbers and a potentially shorter line to finish up a row. Each new row begins on its own line.

Output

* Line 1: A single integer that is the winning cow's score; call it W.

* Lines 2..W+1: Output, one per line, the integers that are the starting square, the next square the winning cow visits, and so on through the last square. If a winning cow can choose more than one path, show the path that would be the 'smallest' if the paths were sorted by comparing their respective 'square numbers'.

Sample Input

4
1 3 2 16
4 10 6 7
8 11 5 12
9 13 14 15

Sample Output

72459101213
本以為最長上升子序列,沒錯,最長的步數對了,但是因為路徑更新有無,所以還是一直Wrong Answer。。。。無語


 

代碼AC后更新

posted on 2008-12-23 21:52 KNIGHT 閱讀(391) 評論(2)  編輯 收藏 引用

FeedBack:
# re: poj 2111 Millenium Leapcow
2008-12-23 23:22 | Knight
如果你能接受這個
3160K 1047MS C++ 1547B
真的很煩,居然1047ms一般都是200ms左右我居然這么多,暈
思路還是最長上升子序列
不過更新路徑的函數代碼如下
int cmp(int a,int b)
{
if(pre[a]==a)
{
if(a>b)return 1;
else if(a==b)return 0;
else return -1;
}
else
{
int t=cmp(pre[a],pre[b]);
if(t==0)
{
if(a>b)return 1;
else if(a==b)return 0;
else return -1;
}
else return t;
}
}
********************************
即如果路徑長度相同的話,就執行cmp從而判斷字典序!更新字典序!很浪費時間!
********************************  回復  更多評論
  
# re: poj 2111 Millenium Leapcow
2008-12-24 12:43 | Knight
魷魚大牛的思路
從n*n開始搜索到1結束DP更新路徑
排名20 3160K 157MS C++ 1228B
還行經典代碼如下:
for(i=M;i>=1;i--)
{
for(j=0;j<8;j++)
{
int x=num[i].x+dir[j][0];
int y=num[i].y+dir[j][1];
if(OK(x,y,i))
{
if(num[i].max+1>num[map[x][y]].max)
{
num[map[x][y]].max=num[i].max+1;
pre[map[x][y]]=i;
}
else if(num[i].max+1==num[map[x][y]].max&&i<pre[map[x][y]])
pre[map[x][y]]=i;
}
}
if(MAX<=num[i].max)
{
MAX=num[i].max;
sign=i;
}
}  回復  更多評論
  

只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


<2009年8月>
2627282930311
2345678
9101112131415
16171819202122
23242526272829
303112345

常用鏈接

留言簿(8)

隨筆檔案

文章檔案

Friends

OJ

搜索

  •  

最新評論

閱讀排行榜

評論排行榜

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            欧美一区二区黄色| 亚洲伊人网站| 亚洲婷婷在线| 亚洲欧洲日夜超级视频| 亚洲国产精品va在看黑人| 在线观看福利一区| 极品尤物一区二区三区| 精品999日本| 午夜精品视频在线观看一区二区| 国产伦精品一区二区三区视频孕妇 | 免费h精品视频在线播放| 午夜精品国产更新| 亚洲自拍啪啪| 久久国内精品自在自线400部| 欧美专区在线| 欧美国产亚洲另类动漫| 欧美午夜激情视频| 最新亚洲电影| 久久久精品网| 欧美激情视频在线播放 | 亚洲人成亚洲人成在线观看图片| 欧美成年人网站| 99re66热这里只有精品3直播 | 另类春色校园亚洲| 亚洲美女在线国产| 久久成人18免费网站| 欧美日韩免费观看一区| 一区在线免费观看| 亚洲欧美不卡| 亚洲黄一区二区三区| 亚洲调教视频在线观看| 狼狼综合久久久久综合网| 欧美日韩精品在线观看| 黄色精品网站| 亚洲欧美中文另类| 亚洲国产日韩欧美| 久久久福利视频| 国产精品久久久久久av下载红粉| 亚洲国产免费看| 久久亚洲精选| 欧美中日韩免费视频| 国产精品久久一卡二卡| 日韩视频在线一区二区三区| 久久国产精品一区二区三区| 99精品国产在热久久| 久久久噜噜噜| 国产亚洲欧美中文| 亚洲美女av黄| 亚洲成色777777在线观看影院| 性欧美精品高清| 欧美日韩亚洲一区在线观看| 亚洲精选一区二区| 欧美成人中文字幕| 久久久久久自在自线| 国产一区日韩欧美| 久久久国产精品一区| 亚洲欧美在线网| 国产手机视频精品| 亚洲网站在线| 91久久久在线| 一区二区激情小说| 在线播放中文字幕一区| 欧美性天天影院| 久久久国产亚洲精品| 亚洲视频精选| 欧美日韩在线精品| 一本久道久久久| 亚洲欧洲三级| 欧美激情精品久久久久久蜜臀| 在线日韩av| 欧美成人福利视频| 久久综合九色综合欧美就去吻| 国产深夜精品| 老司机午夜精品视频| 久久精品国产精品亚洲精品| 一区二区三区在线高清| 欧美成人免费观看| 男男成人高潮片免费网站| 亚洲人成网站色ww在线| 亚洲激情在线观看| 欧美三区在线视频| 亚洲欧美视频| 久久国产天堂福利天堂| 亚洲高清电影| 亚洲美女视频在线免费观看| 国产精品久久久久久久久搜平片 | 乱码第一页成人| 最近中文字幕mv在线一区二区三区四区| 欧美二区乱c少妇| 欧美日韩日本国产亚洲在线| 欧美一区激情| 免费欧美高清视频| 亚洲一区亚洲| 久久在线免费观看视频| 亚洲一区二区高清| 久久嫩草精品久久久久| 亚洲一级免费视频| 欧美一区二区三区四区在线观看| 亚洲国产高清自拍| 亚洲一区二区三区免费观看| 国产在线播精品第三| 亚洲人成亚洲人成在线观看| 国产日韩在线一区| 亚洲人成在线观看一区二区| 国产午夜精品在线观看| 亚洲人成在线播放| 黄色av成人| 亚洲男人影院| 中日韩视频在线观看| 久久亚洲国产成人| 欧美一区二区三区视频在线| 欧美国产综合视频| 欧美国产精品| 亚洲天堂成人| 最新亚洲激情| 久久久久www| 性刺激综合网| 欧美激情视频网站| 欧美成人精品三级在线观看| 国产女主播一区二区| 亚洲精品免费网站| 亚洲国产精品一区二区久 | 一本色道久久综合狠狠躁篇怎么玩| 国产亚洲欧美一区| 亚洲一区二区三区久久 | 国产亚洲精品久久久久动| 亚洲美女av在线播放| 91久久国产综合久久91精品网站| 欧美一区二区三区免费看| 欧美亚洲视频一区二区| 国产精品成人在线观看| 亚洲日本欧美| 亚洲最新在线视频| 欧美精品一区二区三| 亚洲茄子视频| 夜夜嗨av色一区二区不卡| 欧美成人精品在线视频| 亚洲国产欧美不卡在线观看| 亚洲免费久久| 欧美特黄一级| 亚洲综合999| 久久精品国产精品亚洲精品| 国产手机视频一区二区| 久久av一区二区三区| 老巨人导航500精品| 在线精品一区| 欧美精品国产一区| av成人免费在线观看| 亚洲欧美经典视频| 国产午夜精品一区二区三区视频| 欧美在线视频免费| 欧美69视频| 亚洲精品男同| 欧美日韩在线观看一区二区| 亚洲一区二区高清| 久久免费视频在线观看| 亚洲人成在线播放| 国产精品久久久久aaaa| 欧美一区二区视频在线| 欧美成人福利视频| 亚洲一区二区视频| 国产一区二区三区的电影| 狼狼综合久久久久综合网 | 欧美~级网站不卡| 99精品99久久久久久宅男| 国产精品久久久久久久久| 欧美一级大片在线观看| 欧美成人小视频| 亚洲欧美99| 91久久久亚洲精品| 国产精品青草久久| 久久手机精品视频| 一本色道久久| 欧美成人国产| 小黄鸭精品密入口导航| 亚洲国产精品尤物yw在线观看| 欧美/亚洲一区| 欧美成人国产va精品日本一级| 一本一本久久| 欧美a级一区| 香蕉成人啪国产精品视频综合网| 伊伊综合在线| 国产精品露脸自拍| 欧美国产视频在线观看| 午夜欧美精品| 一区二区日韩伦理片| 亚洲福利精品| 久久综合一区二区三区| 午夜精品久久99蜜桃的功能介绍| 亚洲观看高清完整版在线观看| 国产精品盗摄久久久| 久久这里有精品视频| 亚洲性线免费观看视频成熟| 亚洲国产成人av| 久久午夜激情| 亚洲女女做受ⅹxx高潮| 亚洲精品在线一区二区| 在线精品亚洲一区二区| 国产区精品视频| 国产精品日韩二区|