Git Product home page Git Product logo

competition1's Introduction

Competition task algorithms and datastructures

Instructions

The task in the competition task is to design an effective program that can solve the puzzle "rectangles".

The puzzle is entered in a rectangular field. The field contains blank fields and fields with numeric information. The task is to divide the entire area of ​​the given puzzle into rectangles so that:

the rectangles covered the entire specified area, the rectangles did not overlap, each completed field was in a different rectangle, the size of the rectangle (area) was equal to the number of the completed field. When solving, you know that the playing area has a size of at most 32x32 squares, the total number of filled squares is at most 200 and the filled numbers are in the range of 1 to 99.

On the standard input, the program receives the puzzle entry, the entry ends with the end of std. input (active EOF). The exact input format can be seen in the sample run below.

The program analyzes the given puzzle and decides which of the variants occurred: entry is invalid a puzzle was entered on the input, which has only one valid solution. In this case, the program displays this solution. The input was a puzzle that cannot be assembled (0 solutions). The program displays information about the failed attempt. The given puzzle has many solutions (more than one), in which case the program calculates how many different ways the area can be divided. By different methods of division, it is understood that the arrangement of the dividing rectangles differs in the location of at least one boundary line. The program must check the validity of the input data. If incorrect, meaningless or inconsistent values ​​are entered on the input, the program detects this, displays an error message and exits. The format of the error message is shown in the sample run below. The following is considered an error:

missing, irregular or incomplete field frame, the content of the box is different from the space and the number 1-99, missing indication of the corners of the boxes, fields larger than 32 x 32, number of fields filled in more than 200. The program is tested in a limited environment. It is limited by the amount of available memory and run time. Both limits can be seen in the sample test log. In general, the task is not memory intensive. However, it is very CPU intensive. If the puzzle has multiple solutions, exploring all the options can be very time consuming. It is necessary to design an efficient algorithm that will not waste time unnecessarily going through attempts that do not lead to the goal.

The task is evaluated in the competition mode. This means that it is more demanding than standard tasks. Requires a combination of programming and algorithmic skills. It is assumed that the task will be solved by students who have some knowledge of programming, ie students for whom standard tasks are boring. The evaluation consists of a guaranteed point gain (success in non-competitive tests) and a point gain obtained on the basis of placement in the competition with other students (these points will be credited after the end of the competition).

Example

Input

+--+--+--+--+--+
| 2  3        2|
+  +  +  +  +  +
|       2  3   |
+  +  +  +  +  +
|    3         |
+  +  +  +  +  +
|       2      |
+  +  +  +  +  +
| 2        3  3|
+--+--+--+--+--+

Output

One Answer:
+--+--+--+--+--+
| 2| 3      | 2|
+  +--+--+--+  +
|  |    2| 3|  |
+--+--+--+  +--+
|    3   |  |  |
+--+--+--+  +  +
|  |    2|  |  |
+  +--+--+--+  +
| 2|       3| 3|
+--+--+--+--+--+

competition1's People

Contributors

uel avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.