CCPC网络赛题目docx.docx

上传人:b****8 文档编号:9479073 上传时间:2023-05-19 格式:DOCX 页数:23 大小:93.21KB
下载 相关 举报
CCPC网络赛题目docx.docx_第1页
第1页 / 共23页
CCPC网络赛题目docx.docx_第2页
第2页 / 共23页
CCPC网络赛题目docx.docx_第3页
第3页 / 共23页
CCPC网络赛题目docx.docx_第4页
第4页 / 共23页
CCPC网络赛题目docx.docx_第5页
第5页 / 共23页
CCPC网络赛题目docx.docx_第6页
第6页 / 共23页
CCPC网络赛题目docx.docx_第7页
第7页 / 共23页
CCPC网络赛题目docx.docx_第8页
第8页 / 共23页
CCPC网络赛题目docx.docx_第9页
第9页 / 共23页
CCPC网络赛题目docx.docx_第10页
第10页 / 共23页
CCPC网络赛题目docx.docx_第11页
第11页 / 共23页
CCPC网络赛题目docx.docx_第12页
第12页 / 共23页
CCPC网络赛题目docx.docx_第13页
第13页 / 共23页
CCPC网络赛题目docx.docx_第14页
第14页 / 共23页
CCPC网络赛题目docx.docx_第15页
第15页 / 共23页
CCPC网络赛题目docx.docx_第16页
第16页 / 共23页
CCPC网络赛题目docx.docx_第17页
第17页 / 共23页
CCPC网络赛题目docx.docx_第18页
第18页 / 共23页
CCPC网络赛题目docx.docx_第19页
第19页 / 共23页
CCPC网络赛题目docx.docx_第20页
第20页 / 共23页
亲,该文档总共23页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

CCPC网络赛题目docx.docx

《CCPC网络赛题目docx.docx》由会员分享,可在线阅读,更多相关《CCPC网络赛题目docx.docx(23页珍藏版)》请在冰点文库上搜索。

CCPC网络赛题目docx.docx

CCPC网络赛题目docx

ArtClass

TimeLimit:

14000/7000MS(Java/Others)    MemoryLimit:

524288/524288K(Java/Others)

TotalSubmission(s):

0    AcceptedSubmission(s):

0

ProblemDescription

Thisclassisonart.Mr.Picassogiveseverybabyapieceofwhitedrawingpaperandletthempaintonit.

BabyVolcanoisgoingtocolorthedrawingpaperblack.Forconvenience,thedrawingpapercanberegardedasaCartesiancoordinatesystem,andinitially,allpointsonitiswhite.

BabyVolcanoplanstopaintthedrawingpaperin n steps.Inthe ithstep,hewillcolorrectangular Ri black,wherethelowerleftcornerof Ri is (li,0),theupperrightcornerof Ri is (ri,hi).

Let Pi bethedrawingpaperafterthefirst i steps,yourtaskistocalculatetheperimeterofblackareaon Pi.

Input

Thefirstlinecontainsasingleinteger t(1≤t≤100),thenumberoftestcases.

Foreachtestcase,thefirstlinecontainsasingleinteger n(1≤n≤2×105),thenumberofsteps.

Then n linesfollow.Eachlinecontains 3 integers li,ri,hi(1≤li,

Theinputguaranteesthattherearenomorethan 3 testcaseswith n>1000.

Output

Foreachtestcase,output n lines.Eachlinecontainsasingleinteger,representingtheperimeterofblackareaafterthefirst i steps.

SampleInput

1

6

122

343

562

141

261

374

SampleOutput

6

14

20

20

20

22

GraphTheoryClass

TimeLimit:

14000/7000MS(Java/Others)    MemoryLimit:

524288/524288K(Java/Others)

TotalSubmission(s):

0    AcceptedSubmission(s):

0

ProblemDescription

Thisclassisongraphtheory.Mr.Kruskalteachesbabiestheconceptofminimalspanningtree,andhowtocalculatetheminimalspanningtreeofagivengraph.

Now,it'stimeforanin-classquizz.Mr.Kruskalshowsaspecialgraph G:

 G isacompleteundirectedgraphwith n vertices,andverticesin G areindexedfrom 1 to n.Theweightoftheedgebetweenthe ithvertexandthe jthvertexisequalto lcm(i+1,j+1).Babiesareaskedtofindtheminimalspanningtreeof G.

Asasuperbaby,BabyVolcanoquicklyfindsananswer,butheisnotsureonthecorrectnessofhisanswer.YourtaskistotellBabyVolcanotheweightsumofalledgesontheminimalspanningtree,sothathecouldverifyhisanswer.

Giventwopositiveintegers, lcm(i,j) isdefinedastheminimalpositiveinteger k satisfyingboth i and j arefactorsof k.

Input

Thefirstlinecontainsasingleinteger t(1≤t≤50),thenumberoftestcases.

Foreachtestcase,thefirstlinecontainstwointegers n,K(1≤n≤1010,108≤K≤109).

Theinputguaranteesthat K isaprimenumber.

Theinputguaranteesthattherearenomorethan 5 testcaseswith n>109.

Output

Foreachtestcase,outputasinglelinewithasingleinteger,theanswermodule K.

SampleInput

3

3998244353

100998244353

1000000000998244353

SampleOutput

10

6307

192026508

Reports

TimeLimit:

2000/1000MS(Java/Others)    MemoryLimit:

524288/524288K(Java/Others)

TotalSubmission(s):

0    AcceptedSubmission(s):

0

ProblemDescription

BecauseofCovid-19,Kanadeneedstoreporteverytimewhenenteringandleavingschool.NowyouwanttocheckifKanade'sreportsonacertaindayarecorrect.

Asequenceofreportsiscorrectifandonlyiftheredoesnotexisttwoconsecutiveandsamereports.

Input

Thereare T testcasesinthisproblem.

Thefirstlinehasoneinteger T.

Foreverytestcase:

Thefirstlinehasoneinteger n whichdenotesthenumberoftimesKanadereportedonacertainday.

Thesecondlinehas n integers a1,a2,a3,⋯,an, ai denotesthetypeofthe i-threport. ai=0 denotesaleavingschoolreportand ai=1 denotesanenteringschoolreport.

1≤T≤100

3≤n≤50

0≤ai≤1

Output

Foreverytestcase,output``YES''ifKanade'sreportsarecorrect,otherwiseoutput``NO''(withoutquotes)

SampleInput

4

3

111

3

101

5

01010

4

1011

SampleOutput

NO

YES

YES

NO

Lunch

TimeLimit:

6000/3000MS(Java/Others)    MemoryLimit:

524288/524288K(Java/Others)

TotalSubmission(s):

0    AcceptedSubmission(s):

0

ProblemDescription

Nowit'stimeforlunch.Today'smenuischocolate!

Thougheverybabylikeschocolate,theappetitesofbabiesarelittle.Afterlunch,therearestill n piecesofchocolateremained:

Thelengthofthe ithpieceis li.

Usingtheremainedchocolate,BabyVolcanoisgoingtoplayagamewithhisteacher,Mr.Sprague.Theruleofthegameisquitesimple.

Twoplayerplaysinturns,andBabyVolcanowillplayfirst:

1.Ineachturn,theplayerneedstoselectonepieceofchocolate.Ifthelengthoftheselectedpieceisequalto 1,theplayerofthisturnwillloseimmediately.

2.Supposethelengthoftheselectedpieceis l.Thentheplayerneedstoselectapositiveinteger k satisfying k isatleast 2 and k isafactorof l.

3.Thentheplayerneedstocuttheselectedpieceinto k pieceswithlength lk.

Thegamecontinuesuntiloneplayerselectsapieceofchocolatewithlength 1.

Supposebothplayersplaysoptimally,yourtaskistodeterminewhetherBabyVolcanowillwin.

Input

Thefirstlinecontainssingleinteger t(1≤t≤2∗104),thenumberoftestcases.

Foreachtestcase,thefirstlinecontainsasingleinteger n(1≤n≤10).

Thesecondlinecontains n positiveintegers li(1≤li≤109),representingthelengthofeachpiece.

Output

Foreachtestcase,outputchar'W'ifBabyVolcanowillwin,otherwiseoutputchar'L'.

SampleInput

3

2

49

2

23

3

3927

SampleOutput

W

L

L

ExpressMailTaking

TimeLimit:

3000/1500MS(Java/Others)    MemoryLimit:

524288/524288K(Java/Others)

TotalSubmission(s):

0    AcceptedSubmission(s):

0

ProblemDescription

Besidesonthetraditionalclasses,BabyVolcanoalsoneedstolearnhowtotaketheexpressmails.

Usuallyexpressmailsarestoredincabinets.InBabyVolcano'sschool,thereare n cabinetsinarow,numberedby 1 to n.Thedistancebetweentwoadjacentcabinetsis 1,andtheentranceisatthecabinet 1.Amongall n cabinets,theonenumbered k isspecialanditisusedtoenterthecodeandopenthecabinetdoor.

BabyVolcanohas m expressmailstotake,the i-thisinthecabinet ai.

Twoexpressmailswillnotbestoredinthesamecabinet.Alsothereisnoexpressmailinthecabinet k.

Topreventexpressesfrombeingstolen,BabyVolcanohavetotaketheseexpressmailsonebyone,startingattheentrance.Generally,ifhewantstotaketheexpressmail i,hehavetowalktocabinet k firsttoenterthecode,andthenwalkstocabinet ai.Aftertakingthelastone,hewalkstotheentrance.

Therearesomanyexpressmailstotake,soBabyVolcanowantstofindatakingorderwhichminimizethedistancehewalks.

Input

Thefirstlinecontainsoneinteger T(1≤T≤100),thenumberoftestcases.

Foreachtestcases,thefirstlinecontainsthreeinteger n,m,k(1≤k≤n≤109,1≤m

Thenextlinecontains m integer,the i-thstandfor ai(1≤ai≤n,ai≠k).

Theinputguaranteesthat ∑m≤2×106

**Note:

Becauseofthelargeinput,itispreferedtousescanfinsteadofcin.**

Output

Foreachtestcase,Outputasinglelinecontainsoneinteger,representingfortheminimalwalkingdistance.

SampleInput

2

1025

67

1025

34

SampleOutput

14

10

ChessClass

TimeLimit:

4000/2000MS(Java/Others)    MemoryLimit:

262144/262144K(Java/Others)

TotalSubmission(s):

0    AcceptedSubmission(s):

0

ProblemDescription

Thisclassisonchess.BabyVolcanoisplayingaspecialchessgamewithhisfriend,BabyEvil.

Inthischessgame,thereisadirectedgraph G=(V,E).Verticesareindexedfrom 1 to n.Itisguaranteedthateveryvertexhasatleastoneout-goingedge,i.e. ∀v∈V,∃w∈V,(v,w)∈E,BabyVolcanotakescontrolofasubsetofvertices X⊆V,BabyEviltakescontrolof V∖X.Everyvertex v isassignedaweight W(v).

Thereisachess,positioningat s∈V initially.Thegameconsistsofthreephases.

1.Forevery p∈X,BabyVolcanochoosesanout-goingedge (p,q)∈E anddeleteotherout-goingedgesofvertex p.

2.AfterVolcano'soperation,BabyEvilwouldsimilarlychooseanout-goingedge (p′,q′)∈E anddeleteotherout-goingedgesof p′ forevery p′∉X.Bothtwobabiesmakedecisionsbasedonchess'sinitialposition s.

3.Aftertwoprocessesabove,everyvertexwouldremainonlyoneout-goingedge.Thechessstartsmovingalongtheuniquepathintheprocessedgraph,resultinginaninfinitepath L=v0v1v2⋯,where v0=s.BabyVolcanogainsscore CV atlast,whichiscomputedbelow:

CV:

=max{W(vi) | vi appearsin L}

BabyVolcanowantstomaximize CV,whileBabyEvilwantstominimizeit.

Yourtaskistodetermine,forevery s,1≤s≤n,compute CV underthecircumstancethatthechessisputat s initially.

 

Input

Inthefirstlinethereisanumber T,denotesthenumberoftestcases.

Thenthereare T partsofinput,eachpartdescribesatestcase.Eachpartsbeginswith n,m,R,B,denotesthenumberofvertices,edges,therangeof W(v),andthesizeof X,thesetwhichbabyvolcanotakescontrol.

Thenthereisalineconsistsof B numbers,denoteselementsin X.

Thenthereisalinewith n numbers,the i-thnumber,denotes W(i),1≤W(i)≤R.

Thenthereare m lines,eachlineconsistsof 2 numbers, u,v,showingthatthereisanedgefrom u to v in G.

1≤T≤100

1≤m,R≤5×105

1≤B≤n≤5×105

1≤∑n,∑m,∑R≤106

 

Output

Foreachtestcase,youshouldfirstoutput''Case#t:

''(withoutquotes),denotesthetestnumber.

Thenyouneedtooutput n numbersinthenextline,the i-thnumberis CV underthecircumstancethatthechessisputat i initially.

 

SampleInput

2

3321

3

112

12

23

33

46101

4

8732

13

24

32

42

21

22

 

SampleOutput

Case#1:

222

Case#2:

8777

RoboticClass

TimeLimit:

2000/1000MS(Java/Others)    MemoryLimit:

262144/262144K(Java/Others)

TotalSubmission(s):

0    Accepted

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 总结汇报 > 学习总结

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2