1411. Absent |

1412. Boy Scouts |

1413. Perfect Slice |

1415. Elevator |

1416. Fibary |

1417. Overload |

1418. Restaurant tab |

1419. Amazed |

15/10/2024 17:45:54

Моделирование

Олимпиадные задачи на английском языке

Олимпиадные задачи на английском языке

24/06/2010 | Лето 2010 дорешивание ( 4D) |

30/06/2010 | Лето 2010 - 4 (D) |

*Ограничения: время – 1s/2s, память – 64MiB Ввод: input.txt или стандартный ввод Вывод: output.txt или стандартный вывод*

Послать решение Blockly Посылки Темы Где Обсудить (0)

A *die* is a cube whose six faces are marked with 1, 2, 3, 4, 5 and 6 spots, respectively. The
sum of the number of spots on opposite faces of a die is 7; that is, 1 and 6 appear on opposite
faces, 2 and 5 appear on opposite faces, and 3 and 4 appear on opposite faces. This implies that it's
possible to simultaneously see faces numbered 1, 2 and 3 by looking at one of corners; some dice
arrange the faces numbered 1, 2, and 3 *clockwise* about their common corner, others arrange them
*counterclockwise* about their common corner. Both clockwise and counterclockwise arrangements
may occur here. In this problem, there are *dicelines* – collections of dice placed on a table and
aligned from left to right by packing them as tightly as possible in a straight line. Each die has a
face pointing north (N), a face pointing east (E), a face pointing south (S), a face pointing west (W),
a face pointing up (U), and a face pointing down (D).

Input Format

The input contains one or more dicelines, each described by some successive nonempty lines
followed by an empty line. The first line of a diceline contains a positive integer n giving the
number of dice in the diceline. The individual dice in a diceline are referred to as die 0, die 1,
die 2, …, die `n-1`. Each of the remaining input lines of a diceline reveal some information about
numbers facing a direction; specifically, each line contains a direction `d\ ∈\ `{`N, E, S, W, U, D`}, a colon
(`:`), and `n` numbers `∈` {0, 1, 2, 3, 4, 5, 6} separated by commas (`,`) describing the numbers on die 0,
die 1, die 2, …, die `n-1` facing direction `d`. If the number 0 is given for a face of die `i`, then no
information is given about the number on that face.

Output Format

For each diceline in the input, the numbers given for faces of die i either give too little
information to determine the numbers facing each direction (i.e. unknown), give enough information
to uniquely determine the numbers facing each direction (i.e. known), or give inconsistent
information that is physically impossible to realize on a clockwise or counterclockwise die
(i.e. inconsistent). For each die in the diceline, report whether the die is unknown, known, or
inconsistent as shown in the output sample.

Sample Input

1 U:1 S:2 W:3 10 N:3,4,5,0,1,0,0,1,1,6 E:0,2,0,0,5,2,1,4,2,0 U:1,6,2,0,0,4,0,5,3,5 W:0,5,0,0,3,5,6,0,0,4

Sample Output

die 0 is known die 0 is unknown die 1 is known die 2 is inconsistent die 3 is unknown die 4 is inconsistent die 5 is unknown die 6 is unknown die 7 is known die 8 is known die 9 is known