Page 1 of 1

### 2354 archive problem

Posted: Sat Nov 08, 2003 4:57 am
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 ?

### Re: 2354 archive problem

Posted: Mon Nov 24, 2003 6:10 am
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

### Re: 2354 archive problem

Posted: Wed Nov 26, 2003 5:53 am
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.