## 2354 archive problem

Do you want to discuss about these problems? Go now!
Users are shared (no need to re-register).

Moderator: Board moderators

Algoritmo
New poster
Posts: 32
Joined: Wed Oct 15, 2003 12:10 pm
Contact:

### 2354 archive problem

This problem has 102 submissions, 20 Presentation Errors (accepted P.E.) and no Accepted (without P.E.).

Please tell me if my method is correct or not:

1: start a table of N x N, crossing IDs with criminal names. It is filled with boolean value TRUE. T[A] indicates if it is possible that criminal A uses ID B. Present indicates if criminal i is present. Initially no one is present in the hideout.

2:
at each "E arg" or "L arg" input, my program updates the array Present, were i is the number representing criminal arg.
at each "M arg", T[][] is updated in this way: every criminal that's not present cant have the ID arg, so T[j] is FALSE now, to every criminal i not present, and j is the number of ID arg.

3:
after the input finishes, further conclusions are done:
for a = 1 to N:
if row A of T[][] does only have TRUE value in column B, then all other values of column B should be set to FALSE too.
if column A of T[][] does only have TRUE value in row B, then all other values of row B should be set to FALSE too.

4:
criminal name vs ID matches are printed into an array of strings. this array is sorted with quick sort and finally printed out.

My program does deal correctly with multiple test cases and does produce correct answer for the sample input in problem's description page, but I got Wrong Answer.

Does any one have extra test cases ?

horape
New poster
Posts: 49
Joined: Sat Sep 13, 2003 3:18 pm
Location: Buenos Aires

### Re: 2354 archive problem

Algoritmo wrote:Please tell me if my method is correct or not:

3:
after the input finishes, further conclusions are done:
for a = 1 to N:
if row A of T[][] does only have TRUE value in column B, then all other values of column B should be set to FALSE too.
if column A of T[][] does only have TRUE value in row B, then all other values of row B should be set to FALSE too.
How do you handle:

Code: Select all

``````6
A B C D E F
E a
E b
E c
M A
M B
M C
E d
M D
E e
E f
Q
``````
??

Code: Select all

``````a:???
b:???
c:???
d:???
e:???
f:???
``````

Code: Select all

``````a:???
b:???
c:???
d:D
e:???
f:???
``````
Saludos,
HoraPe
Algoritmo
New poster
Posts: 32
Joined: Wed Oct 15, 2003 12:10 pm
Contact:

### Re: 2354 archive problem

horape wrote:How do you handle:
...
Yes, you are correct. I'm impressed with the way you identified that error from such a complex description I posted. I will rethink my code. Thanks.