## IOI '97 P1 - Mars Explorer

View as PDF

Points: 20 (partial)
Time limit: 5.0s
Memory limit: 256M

Problem type

In a future mission to Mars, a pod containing a number of Mars exploration vehicles (MEVs), will be landing on the surface of Mars. All the MEVs will be released the pod's landing site, from which they will move towards a transmitter that has landed a short distance away. While the vehicles move towards the transmitter, they are required to gather rock samples. A rock may only be sampled once, by the first MEV to visit the rock. After that the rock may not be sampled again, but other MEVs may pass the same position. The vehicles cannot move onto rough terrain. The design of the vehicle is such that it can only move south or east in a path that follows the grid pattern from the pod to the transmitter. More than one MEV may occupy the same position at the same time.

 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 2 0 0 0 0 1 1 0 1 2 0 0 0 0 1 0 1 0 0 2 0 1 1 0 0 0 1 0 1 0 0 1 1 0 0 0 1 2 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0

Warning: If a MEV gets stuck, its samples are lost and the sites sampled cannot be resampled.

Calculate the individual movement of the vehicles to maximise the number of rock samples collected and the number of MEVs that reach the transmitter, using the vehicles that landed with the pod.

#### Input Specification

The surface of the planet between the pod and the transmitter is represented by a grid , with the pod position always at position and the transmitter located at . The definitions of the different types of terrain are as follows:

• Clear terrain: 0
• Rough terrain: 1
• Rock sample: 2

The input consists of:

and are the size of the grid, and is an integer less than , representing the number of vehicles released by the pod. lines each represent a row in the surface representation. and will not exceed .

#### Sample Input

2
10
8
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 1 1 0 0 0
0 0 0 1 0 2 0 0 0 0
1 1 0 1 2 0 0 0 0 1
0 1 0 0 2 0 1 1 0 0
0 1 0 1 0 0 1 1 0 0
0 1 2 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0 0 0

#### Output Specification

A sequence of lines representing the movements of the MEVs towards the transmitter. Each line contains a vehicle number and a digit 0 or 1, where 0 is a move South and 1 a move East.

#### Sample Output

1 1
1 0
2 1
2 0
1 1
1 1
2 0
2 1
2 0
2 0
2 0
2 0
1 1
1 0
1 0
1 0
1 0
1 0
1 0
2 0
2 1
1 1
1 1
1 1
1 1
1 1
2 1
2 1
2 1
2 1
2 1
2 1

#### Scoring

Your solution will be deemed correct if the number of samples collected and taken to the transmitter + number of MEVs reaching the transmitter - number of MEVs not reaching the transmitter is equal to the maximum possible score. Note that an illegal move invalidates a solution set. An illegal move occurs when a MEV is moved over rough terrain, or outside the grid.

• 1yangdan  commented on Feb. 11, 2018, 9:45 p.m.

Get this dumb ass question down the problem list. It has a flaw that embarrasses even me: Try this, for those who think they had solved this retarded mess:

2
10
8
0 0 0 0 0 0 0 0 0 0
0 0 0 0 2 2 2 0 0 0
0 0 0 2 0 1 2 0 0 0
2 2 0 2 1 0 2 0 0 2
0 2 0 0 1 0 2 2 2 0
0 2 0 2 0 0 2 2 0 0
0 2 1 0 0 0 0 2 0 0
0 0 0 0 0 0 0 0 0 0

For those who can get 14 samples, you can get 16 samples in total by doing:

5 R

1 D

2 R

3 D

3 R

3 D

That's the first one.

second one:

3 D

1 R

2 D

6 R

2 D

2 R

• aeternalis1  commented on Feb. 12, 2018, 8:33 a.m.

...so what exactly is the flaw? Stating an incorrect answer and a correct answer for a test case doesn’t really show anything.

• Evan_Yu123  commented on Feb. 12, 2018, 9:00 a.m.

A lot of the algorithms (at least 1) that AC-ed would output 14 as the answer for this test case, but the correct answer is 16.

• Kirito  commented on Sept. 18, 2016, 4:01 p.m. edit 6
Problem Back Up

The judge is finally working.

• 1yangdan  commented on Feb. 11, 2018, 9:46 p.m. edited

Judge is stupid.

Edit: Nvm, that year's IOI writer is stupid

• Kirito  commented on Sept. 18, 2016, 2:16 p.m. edit 2
Scoring

Binary scoring has been replaced with the original scoring system.

• 1yangdan  commented on Feb. 11, 2018, 9:47 p.m.

Useless without proper test cases.