<PREV Problem:
NEXT>
Solved by 38 users: Evgeny, Pupyrev, PetrovSergey, robotact, NSI, DD, Dmitry_Gozman, tomek, Vyshnya, MasterZerg, dragonghy, Cheryl, dan, marek.cygan, liuliang, skywalker, toshiba2, andyzh1314, mikleb, zmy, crazyb0y, tourist, davidsun, Chmeli_BSU, wInuX, Ravent, WsemirZ, zloy_mipt, JohnJones_001, mazahaka, pmnox, defrager, Al.Cash, RAVEman, TTLovePP, ripatti, Dest, avg79.
UserDateAttemptTimeCMSC
mikleb04 nov 2007C++500.01652 
zmy21 nov 2007C++200.02663 
pmnox03 feb 2009C++400.02744 
crazyb0y22 jan 2008C++1100.02775 
ripatti17 jun 2010C++300.01810 
JohnJones_00101 nov 2008C++100.02922 
pmnox03 feb 2009C++300.02925 
Pupyrev18 jun 2004C++10?.??929 
Al.Cash31 aug 2009C++400.01962 
Dmitry_Gozman13 dec 2005Kylix400.07999 
Ravent02 aug 2008C++200.021040 
Languages
C++
25
FPC
9
Kylix
4
Java
1
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 

Casket

Time limit = 5 second(s)

Rectangular casket lid is decorated with jewels. All jewel positions has integer coordinates (0 ≤ X,Y ≤ 100). No two jewels are placed to the same place. Jewels form axially symmetry (two axes of symmetry are parallel to sides) picture. But some jewels were lost. The problem is to change positions of minimal number of jewels and make picture axially symmetric.

There may be several solutions, output one of them.

Input The first line contains two even numbers --- lengths of sides of rectangular casket lid. The next line has the number N of jewels and N lines describing jewels positions follow. Each line contains three numbers: jewel id, X and Y jewel's coordinates. Jewels ids are the numbers 1, 2, ... N.

See the figure below: casket with some jewels lost (left) and casket with moved 3-rd and 4-th jewels to their new positions so that picture is axially symmetric (right).

For this figure input data is

6 4
5 
1 1 3
2 1 1
3 4 3
4 4 2
5 5 3

Output The first line should contain minimal number M of jewels to move. Next M lines should have the form:

 < jewel id > < new X coordinate >  < new Y coordinate > 

For the casket in the figure above output may be the following:

2
4 5 1
3 3 2

Input#1
4 12
8
1 1 2
2 3 2
3 1 8
4 1 9
5 1 10
6 3 8
7 3 9
8 3 10
Output#1
2
4 1 3
6 3 3

Author:
Moscow region school contest, 8-9 January 2003
28 January 2003

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


© acm.mipt DevGroup
The page was generated in 200ms

SW soft NIX
ID = 3.228.220.31