<PREV Problem:
NEXT>
Solved by 279 users: ...
UserDateAttemptTimeCMSC
abortmozga.ru30 aug 2009C++3200.01299 
abortmozga.ru30 aug 2009C++3100.01313 
abortmozga.ru30 aug 2009C++2700.01317 
abortmozga.ru30 aug 2009C++2800.01319 
abortmozga.ru30 aug 2009C++2200.01326 
marian13 nov 2004C++1?.??370 
Philip_PV11 jul 2008C++200.03377 
iceland23 may 2003C1?.??378 
Skyslars08 sep 2006FPC1400.04386 
Skyslars20 nov 2006FPC1500.04386 
for_shiv24 feb 2004C++2?.??386 
a47118455514 aug 2012C++200.03387 
Philip_PV11 jul 2008C++100.02388 
svirg30 sep 2007C++200.04389 
seshaoqistudent01 nov 2008FPC100.03390 
FD29 sep 2008FPC100.04390 
Languages
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 DevGroup
The page was generated in 200ms

SW soft NIX
ID = 3.237.200.21