信息学-集训队作业_第1页
信息学-集训队作业_第2页
信息学-集训队作业_第3页
已阅读5页,还剩5页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

回家后就要过年了和想为朋友们表演一下自己的厨艺——做corn*.innn-1uvuv输出文件corn*.outn1,2,3...nx,y

yxi1i412232401001011假设参考解的边长为Best,你的边长为Ans,则你的得分为10AnsBest91Ans>Best,其中[]你可以使用checkerchecker其中TestNo为测试点。例如你已经得到了数据5的输出corn5.out,可checker来测试你的输出是否合法。执行此命令时corn5.in和corn5.out请妥善保存输入文件*.in和你的输出*.out90它的横向“压缩”得太厉害了。来看一下用这种方法对于test10FPgraph,“仍然枚举所有的树根。在处理第一层的时候给每棵预,“ 通过Graph所画出的对于test10的大致图像:用R[i,j]表示将以i为树根的放在宽度为j的空间里,且根放在最顶层时所(R1WH当然也可以在设一个数组D[i,j]表示将以i为树根的放在高度为j的空间R[i,j]的时候就不需要二分了。同时usesgraph,crt;d:array[1..2000,1..2]oflongint;assign(fin,infile);reset(fin);assign(fout,outfile);reset(fout);initgraph(gd,gm,'');forc1:=1tondobeginCircle(d[c1,1]*big+10,d[c1,2]*big+10,bigdiv2); forc1:=1ton-1dobegin主程序{$APPTYPEprogramcorn;b:array[1..maxn]ofinteger;r:array[1..maxn,1..maxr]ofinteger;ansd,d:array[1..maxn]ofarr;height:array[1..maxn]ofinteger;used:array[1..maxn]ofboolean;procedurereaddata;forc1:=1ton-1dobegininc(d[e2].sonnum);d[e2].b[d[e2].sonnum]:=e1;proceduredfs(o:integer);forc1:=1tod[o].sonnumifnotused[d[o].b[c1]]thenbeginfunctionmax(o1,o2:integer):integer;ifo1>o2thenmax:=o1elsemax:=o2;proceduresub1;height:array[1..maxr]ofinteger;q:array[1..maxn]ofinteger;forroot:=1tondobegindfs(root);d[root].father:=0;q[1]:=root;d[root].x:=1;d[root].y:=1;open:=0;closed:=1;w:=1;h:=1;forc1:=1tod[q[open]].sonnumifd[q[open]].b[c1]<>d[q[open]].fatherthenbeginifopen=1thenbeginendelsebeginifopen>1thenbeginendelsebeginforc2:=1tod[d[q[open]].b[c1]].xdobeginifd[d[q[open]].b[c1]].x>wthenw:=d[d[q[open]].b[c1]].x;untilifmax(w,h)<ansthenbeginfunctionsolve(o,range:integer):integer;functionworkwidth(o,range:integer):integer;i:=1;j:=range;k:=1;whilei<jdobegink:=(i+j)divifsolve(o,k)<=rangethenJ:=kelsei:=k+1;ifrange=0thenworkwidth:=infelseifsolve(o,i)<=rangethenworkwidth:=ielseworkwidth:=inf;procedureswap(varo1,o2:integer);k:=o1;o1:=o2;o2:=k;functionsolve(o,range:integer):integer;ifr[o,range]>0thenbeginforc1:=0torange-1dobeginleft:=1;right:=1;forc2:=1tod[o].sonnumifd[o].b[c2]<>d[o].fatherthenbeginifleft+e1<right+e2thenbeginendelsebeginifmax(left,right)<r[o,range]thenbeginifk>0thenbeginleft:=0;forc2:=1tod[o].sonnumifd[o].b[c2]<>d[o].fatherthenbeginifleft+e1<right+e2thenbeginendelsebeginifmax(left,right)<r[o,range]thenbeginendelsesolve:=inf;proceduresub2;forroot:=1tondobeginwrin('ANS=',ans);dfs(root);d[root].father:=0;forc1:=1tomaxrdobeginifr

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论