lithuanian olympiad

2
Lithuanian Olympiad in Informatics Final Round March 20-23, 2015 teismas Dwarves Someone stole the jewellery of the dwarf king! Dwarf police was alerted and they arrested N suspects during the night. The suspects were numbered from 1 to N , and all suspects were locked up in one cell for the night. In the morning, the judge will put the dwarfs into so- litary cells and then interrogate them one by one in a random order. Obviously, every suspect will accuse someone else, not himself. At night, the suspects gathered to agree on their stra- tegy. There’s a new table in the interrogation room. The dwarfs know that this table is the only way to pass some information to the other dwarfs. Namely, dwarfs could leave dents on the table. When the interrogation starts, there will be no dents on the table. During interrogation the dwarf will see the dents which were left by the dwarfs who were interrogated before him. There can never be more than M dents on the table – if there are too many dents, the judge would notice and would prosecute all the suspects. Also, dents can not be removed. All dents look the same to the dwarfs. The judge will interrogate dwarfs in a random order. The future of interrogated dwarf (let’s call him A) depends only on who he accuses. If he accuses someone who’s not interrogated yet, A will be acquitted; if A accuses someone who has already been interrogated – A will be prosecuted (it does not matter if the accused dwarf was prosecuted or acquitted). The suspects know judge habits. They want to agree on a strategy that every dwarf would know what to do, depending on the number of dents on the table (which can be from 0 to M ). After seeing a number of dents, every suspect has to know which dwarf to accuse and how many new dents should be left on the table (if any). Dwarf can behave independently (not necessarily will all dwarfs act the same). Task. Create a strategy that as many dwarfs as possible would be acquitted. It will be tested on various orders of dwarf interrogation, and your points will depend on the average number of acquitted dwarfs. Input. There is no input, because you don’t have to submit a program. Output. For every partial task, provide a text file which would consist of N lines. Every line describes one dwarf strategy. There has to be 2 · (M + 1) space separated integer numbers: • first two show what to do if there are no dents – whom to accuse and how many dents should be left on the table; • third and fourth - what to do when there’s one dent; ... • last two – if there are M dents on the table. Page 1 of 2

description

final round, dwarves, 2015

Transcript of lithuanian olympiad

Page 1: lithuanian olympiad

Lithuanian Olympiad in Informatics

Final Round • March 20-23, 2015 teismas

DwarvesSomeone stole the jewellery of the dwarf king! Dwarfpolice was alerted and they arrested N suspects duringthe night. The suspects were numbered from 1 to N ,and all suspects were locked up in one cell for the night.

In the morning, the judge will put the dwarfs into so-litary cells and then interrogate them one by one ina random order. Obviously, every suspect will accusesomeone else, not himself.

At night, the suspects gathered to agree on their stra-tegy.

There’s a new table in the interrogation room. The dwarfs know that this table is the onlyway to pass some information to the other dwarfs. Namely, dwarfs could leave dents on thetable.

When the interrogation starts, there will be no dents on the table. During interrogation thedwarf will see the dents which were left by the dwarfs who were interrogated before him.There can never be more than M dents on the table – if there are too many dents, the judgewould notice and would prosecute all the suspects. Also, dents can not be removed. All dentslook the same to the dwarfs.

The judge will interrogate dwarfs in a random order. The future of interrogated dwarf (let’scall him A) depends only on who he accuses. If he accuses someone who’s not interrogatedyet, A will be acquitted; if A accuses someone who has already been interrogated – A will beprosecuted (it does not matter if the accused dwarf was prosecuted or acquitted).

The suspects know judge habits. They want to agree on a strategy that every dwarf wouldknow what to do, depending on the number of dents on the table (which can be from 0 toM). After seeing a number of dents, every suspect has to know which dwarf to accuse andhow many new dents should be left on the table (if any). Dwarf can behave independently(not necessarily will all dwarfs act the same).

Task. Create a strategy that as many dwarfs as possible would be acquitted. It will betested on various orders of dwarf interrogation, and your points will depend on the averagenumber of acquitted dwarfs.

Input. There is no input, because you don’t have to submit a program.

Output. For every partial task, provide a text file which would consist of N lines. Every linedescribes one dwarf strategy. There has to be 2 · (M + 1) space separated integer numbers:

• first two show what to do if there are no dents – whom to accuse and how many dentsshould be left on the table;

• third and fourth - what to do when there’s one dent;. . .

• last two – if there are M dents on the table.

Page 1 of 2

Page 2: lithuanian olympiad

Lithuanian Olympiad in Informatics

Final Round • March 20-23, 2015 teismas

The number of all dents on the table can not exceed M . Also, no suspect will accuse himself.

Examples.

Input Output CommentN = 3M = 1

2 1 3 03 0 1 02 0 1 0

Example described below.This is not the optimum strategy, it’s onlyone of the many possible.

In the example, first dwarf will behave in such a way:

• if he sees 0 dents, will accuse second dwarf and will leave 1 dent on the table;• if he sees 1 dent, will accuse third dwarf and will not leave any more dents.

Second and third dwarfs will not add new dents. If they see 1 dent, they’ll accuse the firstdwarf, if they see 0 – they will accuse each other.

If dwarfs will be interrogated in order (first, second, then third):

• first dwarf will accuse second, so first one will be acquitted; he will leave one dent;• second dwarf will accuse first, so he will be prosecuted;• third dwarf will accuse first, so he will be prosecuted.

Otherwise, if second dwarf would be interrogated firstly, then third, and only then first dwarfwould be interrogated, then second dwarf would walk free, the other two would be prosecuted.

Vertinimas. For every partial task there are K = 100 000 permutations generated, whi-ch correspond to possible ways the suspect dwarfs can be interrogated. The strategy youproposed will be tested with all these permutations. Number of points you get depend onthe average number of acquitted dwarfs V = (T1 + · · · + TK)/K. For suggested strategy yourmark will be

20 ·(

V

S

)4

Parameter S corresponds to result V , which is the best solution that we know and dependson the subtask. Points you get will be rounded up, but will not exceed 20.

Subtasks.

Nr. N M S1 10 1 6.52 100 2 70.53 100 3 74.74 100 6 77.95 100 10 80.7

Page 2 of 2