Author: | Far-Eastern Subregional | |||
Input file: | input.txt | Time limit: | 1 sec | |
Output file: | output.txt | Memory limit: | 8 Mb |
The game of Tetris is played with four-connected blocks falling down the well having N rows and 20 columns. Each figure is marked with a unique English letter from 'A' to 'Z'.
Your program must, given the state of the well, determine the order in which the blocks fell down.
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
Author: | Far-Eastern Subregional | |||
Input file: | input.txt | Time limit: | 3 sec | |
Output file: | output.txt | Memory limit: | 8 Mb |
A university network is composed of N computers. System administrators gathered information on the traffic between nodes, and carefully divided the network into two subnetworks in order to minimize traffic between parts.
A disgruntled computer science student Vasya, after being expelled from the university, decided to have his revenge. He hacked into the university network and decided to reassign computers to maximize the traffic between two subnetworks.
Unfortunately, he found that calculating such worst subdivision is one of those problems he, being a student, failed to solve. So he asks you, a more successful CS student, to help him.
The traffic data are given in the form of matrix C, where Cij is the amount of data sent between ith and jth nodes (Cij = Cji, Cii = 0). The goal is to divide the network nodes into the two disjointed subsets A and B so as to maximize the sum of all Cij, where i belongs to A, and j belongs to B.
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
Author: | Far-Eastern Subregional | |||
Input file: | input.txt | Time limit: | 1 sec | |
Output file: | output.txt | Memory limit: | 8 Mb |
A year calendar is printed using the monospace font according to the following rules:
1) All spaces on the printed calendar are represented by the dot character (ASCII 46).
2) Every month occupies a rectangle of 17 by 8 characters, with the name of the month written in all capital letters starting from the 2nd character of the first line.
3) All days of the months are printed in 4, 5, or 6 columns 2 characters wide and 7 characters high, with one space between the columns. The first day of the week is Monday.
4) Months of the year are arranged in the three rows separated by horizontal and vertical lines of spaces. Each row contains four months. The calendar margins are of 1 space from all sides. Therefore, the whole calendar has size of 73 by 28 characters.
Note that January 1st, 1900 was Monday. Also note that a leap year number is divisible by 4 and not divisible by 100, or divisible by 400. For example, a part of the printed calendar from October to December 2002 may look like this:
.OCTOBER...........NOVEMBER..........DECEMBER.........
....7.14.21.28........4.11.18.25........2..9.16.23.30.
.1..8.15.22.29........5.12.19.26........3.10.17.24.31.
.2..9.16.23.30........6.13.20.27........4.11.18.25....
.3.10.17.24.31........7.14.21.28........5.12.19.26....
.4.11.18.25........1..8.15.22.29........6.13.20.27....
.5.12.19.26........2..9.16.23.30........7.14.21.28....
.6.13.20.27........3.10.17.24........1..8.15.22.29....
......................................................
A calendar was printed and then burned, with only a small rectangular piece left. Your program must determine to which of years from 1900 to 2100 this piece could belong.
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|
Author: | Far-Eastern Subregional | |||
Input file: | input.txt | Time limit: | 1 sec | |
Output file: | output.txt | Memory limit: | 8 Mb |
A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequence of the given numeric sequence (a1, a2, ., aN) be any sequence (ai1, ai2, ., aiK), where 1 ≤ i1 < i2 < ... < iK ≤ N. For example, the sequence (1, 7, 3, 5, 9, 4, 8) has ordered subsequences, e. g., (1, 7), (3, 4, 8) and many others. All longest ordered subsequences of this sequence are of length 4, e. g., (1, 3, 5, 8).
Your program, when given the numeric sequence, must find the length of its longest ordered subsequence.
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
Author: | Far-Eastern Subregional | |||
Input file: | input.txt | Time limit: | 1 sec | |
Output file: | output.txt | Memory limit: | 8 Mb |
It is hard to make the playing card stand on its edge, however, some patient person managed to put N of them upon the desk in such a way that each cards stands on its shorter edge. The top-down view of that desk with cards upon it can be represented with the set of line segments with coordinates (xi, yi) to (vi, wi). The segments do not intersect.
The first card falls flat on its side, causing any card it touches to fall down also. The angle between vector (x1, y1)-(v1, w1) and the falling direction of the first card is equal to 90 degrees (measured counter-clockwise). If card A touches card B, the direction of B's fall is chosen so that the continuation of the direction vector does not cross the line containing segment A. Input data are guaranteed to never contain:
1) a card falling exactly perpendicular to the other and
2) a falling card that touches more than one of still standing cards.
Your program must determine which cards will fall, and which shall remain standing.
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
Author: | Far-Eastern Subregional | |||
Input file: | input.txt | Time limit: | 1 sec | |
Output file: | output.txt | Memory limit: | 8 Mb |
During a preparation of programming contest, its jury is usually faced with many difficult tasks. One of them is to select a problem simple enough to most, if not all, contestants to solve.
The difficulty here lies in diverse meanings of the term "simple" amongst the jury members. So, the jury uses the following procedure to reach a consensus: each member weights each proposed problem with a positive integer "complexity rating" (not necessarily different for different problems). The jury member calls "simplest" those problems that he gave the minimum complexity rating, and "hardest" those problems that he gave the maximum complexity rating.
The ratings received from all jury members are then compared, and a problem is declared as "very simple", if it was called as "simplest" by more than a half of the jury, and was called as "hardest" by nobody.
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|