Solved by 279 users: ...
UserDateAttemptTimeCMSC
abortmozga.ru`30 aug 2009`C++3200.01299
abortmozga.ru`30 aug 2009`C++3100.01313
abortmozga.ru`30 aug 2009`C++2700.01317
abortmozga.ru`30 aug 2009`C++2800.01319
abortmozga.ru`30 aug 2009`C++2200.01326
marian`13 nov 2004`C++1?.??370
Philip_PV`11 jul 2008`C++200.03377
iceland`23 may 2003`C1?.??378
Skyslars`08 sep 2006`FPC1400.04386
Skyslars`20 nov 2006`FPC1500.04386
for_shiv`24 feb 2004`C++2?.??386
a471184555`14 aug 2012`C++200.03387
Philip_PV`11 jul 2008`C++100.02388
svirg`30 sep 2007`C++200.04389
seshaoqistudent`01 nov 2008`FPC100.03390
FD`29 sep 2008`FPC100.04390
 C++ 133 FPC 97 Kylix 19 C 19 Java 13 Ruby 1
` >  >  >  >  >  >  >  >  >  > `

## Triangles

Time limit = 5

Equilateral triangle is given. Each side divided to N equal parts by N-1 points, each of which connected with two points on other sides, by lines parallel to sides of the triangle. So the triangle is divided to N2 equilateral triangles. Numbers from 1 to N2 are written on this small triangles and on each of common sides of small triangles, written sign '<' (less) or '>' (more), which says that number in one triangle is less or more then number in another. You are to find one of possible placements of numbers for given signs.

Input First line of input contains one integer: N (2<=N<=50). After that (N-1)*2 lines contains signs on sides of triangles. In line number n*2+1 there are given n+1 signs on horizontal line between rows number n+1 and n+2, '<' means that number on the top less then number on the bottom and vice versa. Line number n*2+2 contains (n+1)*2 signs on slanting sides of triangles in row number n+2, '<' means that left number is less than right number and vice versa.

Output If it is impossible to place the numbers output contains "0", otherwise first line of output contains "1" and N following lines contains numbers separated by space. In n'th line there are n*2-1 numbers form n'th row.

 Input#1```3 > <> <> <<>< ``` Output#1```1 9 1 7 4 2 5 8 3 6 ```

Author:
Sergey Ulanov
10 may 2003

<PREV | Problem set | Search related messages | NEXT>

 © acm.mipt DevGroupThe page was generated in 180ms