AMERICAN COMPUTER SCIENCE LEAGUEIntermediate Division - StretchContest #3PROBLEM: Given a rectangular grid and the 3 types of pieces shown below, the object of Stretch is toplace pieces in the grid so that they form a connected path from the left side to the right side or from theright side to the left side. If the initial piece is in the leftmost column, the path goes to the rightmostcolumn. If the initial piece is in the rightmost column, the path goes to the leftmost column. Regardlessof which direction the path is created, the output is always from left to right.● A piece cannot be rotated or flipped.● A piece can only connect to the last piece that was placed and one column to the right of thatpiece if the path is left-to-right OR one column to the left of that piece if the path is right-to-left.● A piece can connect only at a tile with a circle and the tiles with the circles are the only tiles thatare allowed to touch.● All tiles of the connecting piece must be to the right (if left-to-right) or to the left (if right-to-left)of all previously placed pieces.● A piece cannot be placed in the grid such that it would cover any part of another piece, cover ablocked cell, or extend beyond the grid.● The one and only tile allowed to touch the starting side is a circle tile.● The one and only tile allowed to touch the opposite side is a circle tile.● Pieces are placed in alphabetical order. If a piece does not fit, skip it and use the next piece thatfits. When Piece C is either used or skipped, then begin again with Piece A.● Grid cells are numbered consecutively starting with 1 in the upper left corner and continue fromleft to right and from top to bottom.● We guarantee that if a piece can be placed, then that will be the only location it can be placed.2018-2019AMERICAN COMPUTER SCIENCE LEAGUEIntermediate Division - StretchContest #3EXAMPLE: The following example is a 6 x 10 grid with a starting cell of 11. There are blocked cells atcells 23 and 37. Piece A is placed at 11. Piece B can only be placed at 14. The next piece must connectat 26. Piece C cannot be placed at 26 because there is a blocked cell at 37. Therefore, Piece C is skipped.Piece A is placed at Location 26. The next piece must connect at 29. Piece B is placed at 29 and touchesthe right side at 40. Therefore, the path is ABAB.INPUT: There will be 5 lines of data. Each line will contain the numbers: r , c , s, n , followed by nnumbers. r indicates the number of rows in the grid. c indicates the number of columns in the grid. sindicates the starting cell number for the first piece. n indicates the number of blocked cells. The next nnumbers are the cells that are designated as blocked.OUTPUT: Form a path from the starting cell to the opposite edge of the grid using the algorithm above.Print the sequence of pieces that were used to form the path from left to right.SAMPLE INPUT http://www.datafiles.acsl.org/2019/contest3/int-sample-input.txt6 10 11 2 23 374 9 10 2 23 265 9 1 2 13 264 10 40 2 13 265 15 75 1 40SAMPLE OUTPUT1. ABAB2. AAA3. ACBB4. ABCA5. ACBABA本团队核心人员组成主要包括硅谷工程师、BAT一线工程师,精通德英语!我们主要业务范围是代做编程大作业、课程设计等等。我们的方向领域:window编程 数值算法 AI人工智能 金融统计 计量分析 大数据 网络编程 WEB编程 通讯编程 游戏编程多媒体linux 外挂编程 程序API图像处理 嵌入式/单片机 数据库编程 控制台 进程与线程 网络安全 汇编语言 硬件编程 软件设计 工程标准规等。其中代写编程、代写程序、代写留学生程序作业语言或工具包括但不限于以下范围:C/C++/C#代写Java代写IT代写Python代写辅导编程作业Matlab代写Haskell代写Processing代写Linux环境搭建Rust代写Data Structure Assginment 数据结构代写MIPS代写Machine Learning 作业 代写Oracle/SQL/PostgreSQL/Pig 数据库代写/代做/辅导Web开发、网站开发、网站作业ASP.NET网站开发Finance Insurace Statistics统计、回归、迭代Prolog代写Computer Computational method代做因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:99515681@qq.com 微信:codehelp
网友评论