746 Polygon Visibility - UVa Online Judge
746 Polygon Visibility - UVa Online Judge
746 Polygon Visibility - UVa Online Judge
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>746</strong> ACMContestProblemsArchive <strong>Polygon</strong><strong>Visibility</strong> UniversityofValladolid(SPAIN)<br />
polygons,itisnecessarytoidentifythesetofpointsintheplanefromwhichthevisibilityofthe Asabuildingblockofanewgraphictool,avisibilityfunctionhastobedesigned:Giventwoconvex secondpolygonisobstructedbytherstone.Moreprecisely,youarelookingforthepointsP,notin theinterioroftherstpolygon,forwhichthereisapointQinthesecondpolygonsuchthattheinterior implementsthatbuildingblock. ofthelinesegmentPQcontainssomepointoftherstpolygon.Yourtaskistowriteaprogramthat<br />
arenotincludedinthesetofpointsfromwhichthevisibilityisobstructed. segmentstogetherwithtwoinnitelines.Rememberthatthepointsintheinterioroftherstpolygon Youmayassumethatthetwopolygonshavenocommonpointsandthatneitheroneisdegenerate. Thesetofpointsfromwhichthevisibilityisobstructedcanbedescribedbyanitesetofnite<br />
Input Theinputlecontainsseveralinstances.Eachinstanceconsistsofthefollowingconsecutivelines: OnelinecontainingtwopositiveintegersNandMseparatedbyoneormoreblankspaces.These<br />
NlinescontainingeachapairofcoordinatesintheXYplane,separatedbyoneormoreblank arethenumberofverticesoftherstandthesecondpolygons.Youmayassume3N;M<br />
spaces.Thesearetheverticesoftherstpolygon.Everycoordinateisanintegernumberinthe 10000.<br />
MlinescontainingeachapairofcoordinatesintheXYplane,separatedbyoneormoreblank range1..10000.<br />
00andshouldnotbeprocessed. Theverticesofeachpolygonappearinclockwiseorder.Theinputleendswithalinecontaining spaces.Thesearetheverticesofthesecondpolygon.<br />
lines,theverticesthatdenethenitesegments,andthesecondinniteline. setofpointsfromwhichthevisibilityisobstructed.Thedescriptionisformedbyoneoftheinnite Output Foreachinstance,youmustwritealinethatidentiesthatinstance,followedbyadescriptionofthe<br />
representedbytheslopeoftheline,roundedtothreedigitstotherightofthedecimalpoint.Iftheline isvertical,thewordVERTICALmustreplaceitsslopevalue.Eachvertexmustberepresentedwithits coordinates,separatedbyaspace.Toavoidambiguity,theverticesmustbegiveninclockwiseorder Eachlineandeachvertexmustappearinaseparatelineofoutput.Eachinnitelinemustbe<br />
withrespecttotherstpolygon.
SampleInput ACMContestProblemsArchive<br />
33 1020 2020 2010 1010 75 57 43 2019 2515 2010 1515 1020 1010 515 00 SampleOutput Instance1 VERTICAL 1020 2020 2010 0.000 Instance2 1.000 1515 2019 2515 2010 -1.000<br />
UniversityofValladolid(SPAIN)