做了一夜 再也不想敲键盘了..等等再报告 贴出来先 (其实又没人看….)
没有什么任何优化 直接0msAC 真不好意思 XD
[c]
#include <cstdio>
#include <cstring>
#include <cmath>
#define MAXNUM 2000
typedef struct pair {
int v,l;
} Pair;
typedef struct pointer {
int p,num;
} Pointer;
Pair a[MAXNUM],r[MAXNUM];
int width,prow,rp;
Pointer p2,p5,p8;
void calc();
void set(Pointer *target,int p,int num);
void go(int spit,int steps);
void gop(Pointer *p,int steps);
int pre(Pointer p);
int next(Pointer p);
int spit();;
int main() {
int i;
while(1) {
rp=0;
scanf("%d",&width);
if(width==0) {
printf("0\n");
return 0;
}
for(i=1;;i++) {
scanf("%d%d",&a[i].v,&a[i].l);
if(!a[i].v&&!a[i].l)
break;
}
a[0].v=a[i].v=-1;
a[0].l=a[i].l=width;
r[0].v=-1;
r[1].l=0;
calc();
printf("%d\n",width);
for(i=1;;i++) {
printf("%d %d\n",r[i].v,r[i].l);
if(!r[i].v&&!r[i].l)
break;
}
}
}
void calc() {
int i,counter;
int x,y,z,steps;
prow=1;
set(&p2,0,1);
set(&p5,1,1);
counter=0;
for(i=1;counter<=width;i++)
counter+=a[i].l;
i–;
set(&p8,i,width-counter+a[i].l+1);
while(1) {
if(a[p5.p].v==-1)
break;
x=a[p2.p].l-p2.num;
y=a[p5.p].l-p5.num;
z=a[p8.p].l-p8.num;
steps=x>y?y:x;
steps=steps>z?z:steps;
if(steps<3) {
go(spit(),1);
continue;
} //可在此处插入判断边界程序
go(spit(),1);
go(spit(),steps-1);
}
rp++;
r[rp].v=r[rp].l=0;
}
void set(Pointer *target,int p,int num) {
target->p=p;
target->num=num;
}
int spit(){
int result=0,i=0,temp,x=a[p5.p].v;
bool top=false,bottom=false;
if(a[p2.p].v==-1)
top=true;
if(a[p8.p].v==-1)
bottom=true;
if(prow!=1) {
if(!top)
result=(temp=fabs(pre(p2)-x))>result?temp:result;
result=(temp=fabs(pre(p5)-x))>result?temp:result;
if(!bottom)
result=(temp=fabs(pre(p8)-x))>result?temp:result;
}
if(prow!=width) {
if(!top)
result=(temp=fabs(next(p2)-x))>result?temp:result;
result=(temp=fabs(next(p5)-x))>result?temp:result;
if(!bottom)
result=(temp=fabs(next(p8)-x))>result?temp:result;
}
if(!top)
result=(temp=fabs(a[p2.p].v-x))>result?temp:result;
if(!bottom)
result=(temp=fabs(a[p8.p].v-x))>result?temp:result;
return result;
}
int pre(Pointer p) {
if(p.num==1)
return(a[p.p-1].v);
else
return(a[p.p].v);
}
int next(Pointer p) {
if(p.num==a[p.p].l)
return(a[p.p+1].v);
else
return(a[p.p].v);
}
void go(int spit,int steps) {
if(r[rp].v==spit)
r[rp].l+=steps;
else {
rp++;
r[rp].v=spit;
r[rp].l=steps;
}
gop(&p2,steps);
gop(&p5,steps);
gop(&p8,steps);
prow=(prow+steps-1)%width+1;
}
void gop(Pointer *p,int steps) {
p->num+=steps;
while(p->num>a[p->p].l) {
p->num-=a[p->p].l;
p->p++;
}
}
[/c]
怎么会木有人看
感觉要用双链表…….敲了一下午样例都调不过= =
找度娘搜题解跑到这里来了….
报告赶紧补上吧^ ^
这个是两年前的贴了,已经物是人非..
不写代码了现在,根据我【极为】有限的印象,这题好像没什么数据结构,寻找边界就可以(显然..),比如
150 150 150 150 150 150 150
100 100 100 100 100 100 100
100 100 100 100 100 100 100
100 100 100 100 100 100 100
100 100 100 100 100 100 100
100 100 100 100 100 100 100
100 100 100 100 99999 100 100
100 100 100 100 100 100 100
100 100 100 100 100 100 100
100 100 100 150 150 150 150
在【考虑同一列上中下三个数字】的情况下,在哪些位置【上中下任意数字】发生的改动,会影响结果
哎ái呀..可能毫无用处, 以上是我零散的记忆.. 当时还给谁讲的所以记得一点点..
果然解题报告什么的拖了两年心中就空无一物了。
其实双链表也是这个用处……查找每个数据块后的就可以找到下一行的像素,超过一行停止查找就行了 每个数据块的首元素和为元素单独构成一个链表,因为要判断周围8格的情况…….像素被更新时,就在链表中间插入一个新的链表……
orz…..FUNK那段视频的背景,好像设备齐全的样子,自己搭建的么,求指导
笔记本+外接屏幕
台式机+屏幕×2
怎样实现鼠标在不同机器间切换?本来想弄个USB一分二神马的再写程序用快捷键锁定相应机器的按键,不过这样太麻烦了。
终于有一天一哥们给我推荐了Synergy,通过网络共享的,延迟很小,巨好用。
混音么我用的cubase,想学的话自己不断录点东西再听听大师的作品,(midi)控制器什么的用到的时候就自然买了 =D
我主动忽略了算法的问题..
References:
Spielautomaten online spielen https://casino-petersberg.online-spielhallen.de/
References:
Legiano Casino Code https://forum.xnxx.com
References:
Legiano Casino Umsatzbedingungen cm-us.wargaming.net
References:
Legiano Casino Spielautomaten image.google.ge
References:
Legiano Casino Freispiele https://www.russianrealty.ru/bitrix/redirect.php?goto=https://de.trustpilot.com/review/edelkranz.de
References:
Legiano Casino Paysafecard https://m.so.com/index.php?q=l2l.li/christophersin
References:
Legiano Casino Auszahlungslimit http://vilejski-uezd.by/proxy.php?link=https://de.trustpilot.com/review/edelkranz.de
References:
Legiano Casino Willkommensbonus https://href.li
References:
Legiano Casino Gutschein http://aktsh.ru/go.php?url=http://images.google.by/url?q=https://de.trustpilot.com/review/der-wikinger-shop.de
References:
Legiano Casino Umsatzbedingungen alltrack.org
References:
KingMaker konto aufladen https://csvip.me/coyjudge996303
References:
Kingmaker casino registrieren und einzahlen https://biolink.website/terarowe8
References:
Kingmaker Casino Software https://upangmarga.go.id/germanfreud990
References:
KingMaker Casino Einzahlung jetzt s.nas.vn
References:
Kingmaker casino paysafecard einzahlung http://nashi-progulki.ru/
References:
Kingmaker Casino Roulette http://maps.google.iq/url?sa=t&url=https://de.trustpilot.com/review/beyondjewellery.de
References:
Kingmaker Casino Live Casino images.google.com.mx
References:
KingMaker Casino Treuebonus maps.google.dm
References:
Kingmaker casino bankeinzahlung https://link.zhihu.com/?target=http://de.trustpilot.com/review/beyondjewellery.de
References:
Kingmaker casino bankeinzahlung nl.thefreedictionary.com
References:
Legiano Casino Support http://es.thefreedictionary.com/_/cite.aspx?url=http://rentry.co/cgrrmwz4&word=apostata&sources=vox_manual,vox1,kdict,vox_thes,open_thes,hc_Es_En
References:
KingMaker Casino Einzahlung Spielgeld http://toolbarqueries.google.bs
References:
KingMaker Casino Echtgeld App images.google.co.ck
References:
KingMaker Casino Freispiele bei Einzahlung
https://cam7.chaturbate.com/external_link/?url=https://sbfpageing.com/a1zrq
References:
KingMaker Casino Einzahlung per Sofortüberweisung https://book.douban.com/link2/?pre=0&vendor=jingdong&srcpage=subject&price=10190&pos=1&url=https://k1t.kr/alvarodacomb80
References:
Legiano Casino Kontakt images.google.com.sl
References:
Legiano Casino Mindestauszahlung maps.google.co.zm
References:
KingMaker Casino Konto eröffnen Bonus maps.google.co.ao
References:
Legiano Casino Sicherheit http://images.google.com.om
References:
Legiano Casino Bonusbedingungen https://en.asg.to
References:
Legiano Casino Echtgeld https://book.douban.com
References:
KingMaker Casino Einzahlung mit Google Pay https://legal-dictionary.thefreedictionary.com
References:
KingMaker Casino Einzahlung per Bitcoin toolbarqueries.google.co.kr
References:
Legiano Casino Freispiele http://clients1.google.com.bd
References:
Kingmaker Casino Strategy http://images.google.lu
References:
KingMaker Casino Echtgeld spielen http://cse.google.ml/url?q=https://qrlinkgenerator.com/wwlsanora11911
References:
KingMaker apple pay https://forum.corvusbelli.com/
References:
Legiano Casino Verifizierung toolbarqueries.google.com.cy
References:
KingMaker einzahlungslimits http://www.google.at
References:
Legiano Casino Mobile http://www.rojadirecta.eu/goto/literaturewiki.site/wiki/Offizielle_Schweizer_Seite
References:
Kingmaker casino anmelden einzahlung http://cse.google.ac
References:
Legiano Casino Auszahlung https://imslp.org
References:
Hitnspin casino auszahlungsdauer https://mcpedl.com
References:
Hitnspin registrierung http://parrots.ru/proxy.php?link=https://analytics.maryland.gov/search/de.trustpilot.com/review/der-wikinger-shop.de
References:
Monro Casino Verifizierung https://kpbc.umk.pl
References:
Hitnspin kundensupport http://toolbarqueries.google.mn/url?sa=t&url=https://tdec.tn.gov/single_signon/Account/LogIn?returnurl=https://de.trustpilot.com/review/der-wikinger-shop.de