Page 1 of 2

285 - Crosswords

Posted: Mon Jan 05, 2004 10:59 am
by junbin
Anyone can tell me what sort of weird test data they will provide?

Would these be possible:

1) The crossword requires a rotation before it fits.
2) Extra spaces are inserted before a row in the solution
3) Spaces are removed from the start/end/middle of a row in the solution
4) The crossword has to be shifted by an offset before it fits.

In essense, I would like to know the answer to the following test data:

(1)
abc 1 1 r
abc 1 1 d
#
3
3
cba b c$

(2)
abc 1 1 r
abc 1 1 d
#
3
3
abcb c $
abc 1 1 r
abc 1 1 d
#
3
3
abc b c $

(3)
abc 1 1 r
abc 1 1 d
#
3
3
abcbc $
abc 1 1 r
abc 1 1 d
#
3
3
abcb c$
abc 2 1 d
abc 1 2 r
#
3
3
a abcc $
abc 2 1 d
abc 1 2 r
#
3
3
a abc c $
abc 1 1 r
abc 1 1 d
abc 3 3 u
abc 3 3 l
#
3
3
abcbbcba$


(4)
abc 2 2 r
abc 2 2 d
#
3
3
abcb c $
abc 1 1 r
abc 1 1 d
#
4
4
abc b c $



Will any of the above sample test data result in correct solution?

Posted: Mon Jan 05, 2004 11:20 am
by Per
My AC program assumes 1) No, 2) Yes, 3) Yes and 4) No.

So the first and last two of your inputs are incorrect solutions, and the other correct.

Posted: Mon Jan 05, 2004 2:26 pm
by junbin
Thank you so much for your tips.. after some more trial and errors, I've managed to get AC. :)

Posted: Sat Apr 10, 2004 3:19 am
by Ryan Pai
This is what I'm doing, and it's wrong but I don't know why:

a) Build the actual crossword solution as a two dimentional matrix of characters, rembering the size of the matrix
b) create a string from that matrix by treating each row as a string and concatenating rows
c) removing all spaces from this constructed string
d) remove all spaces from the proposed solution
e) Return correct iff both strings agree and if the size of the actual solution's size agrees with the proposed solution's size

Posted: Mon Jun 14, 2004 4:57 am
by Quantris
I've got the same problem

it's working for all the inputs I can think of, any tricky inputs or interpretation of the problem that we should know about?

Posted: Sat Jul 31, 2004 11:04 pm
by Dominik Michniewski
Only I think you must assume: what is meaning of width and height of solution ;-) I made such mistake, so my first 3 submissions was rejected by judge

Best regards
DM

Posted: Sun Aug 01, 2004 9:16 am
by Quantris
I'm pretty sure I did that properly - i verified whether the given width/height were indeed the minimums required (as stated in the problem), and if not, reported an incorrect solution. Is that the correct interpretation?

Posted: Mon Aug 02, 2004 8:30 am
by Dominik Michniewski
Problem is, that minimum width / height of crossword in this problem isn't real minimal width / height. I discovered it after a few of submissions. So if you have input like

Code: Select all

alas 2 1 r
#
4
1
alas$
you must report 'incorrect solution'. Why - try to think about ;-)

Best regards
DM

PS. Meaning of width/height in this problem isn't correct for me - and is far from reality :(

Posted: Mon Aug 02, 2004 10:02 am
by Quantris
actually, my WA program *does* say "incorrect solution" for that one!

Thanks for trying to help though, I appreciate it.

EDIT: BTW, my program says "correct solution" when the input is:

Code: Select all

alas 2 1 r
#
5
1
alas$ 

Posted: Wed May 03, 2006 6:40 pm
by Quantris
Anyone have any suggestions for this one?

Posted: Thu May 04, 2006 1:42 am
by stubbscroll
I don't remember the details any longer since it's so long ago since I solved it, but here's the I/O I used when I solved it (your input is also in here somewhere):

Input:

Code: Select all

second 1 1 r
vis 1 3 r
file 2 4 u
castle 3 1 d
end 6 3 u
#
6
6
second la  nvis  e ft  l  e   $
sample 1 4 r
output 1 7 r
for 3 3 u
crossword 1 1 d
is 2 5 l
correct 1 1 r
#
7
9
correctr o    o f    sample  si     w      output r      d      $
ruben 1 1 r
einar 1 2 r
d 1 3 r
e 4 3 r
#
5
3
rubeneinard e $
alas 2 1 r
#
4
1
alas$
alas 2 1 r
#
5
1
alas$
alas 1 1 r
#
6
1
alas$
abc 1 1 r
abc 1 1 d
#
3
3
cba b c$
abc 1 1 r
abc 1 1 d
#
3
3
abcb c $
abc 1 1 r
abc 1 1 d
#
3
3
abc b c $
abc 1 1 r
abc 1 1 d
#
3
3
abcbc $
abc 1 1 r
abc 1 1 d
#
3
3
abcb c$
abc 2 1 d
abc 1 2 r
#
3
3
a abcc $
abc 2 1 d
abc 1 2 r
#
3
3
a abc c $
abc 1 1 r
abc 1 1 d
abc 3 3 u
abc 3 3 l
#
3
3
abcbbcba$
abc 2 2 r
abc 2 2 d
#
3
3
abcb c $
abc 1 1 r
abc 1 1 d
#
4
4
abc b c $
Output:

Code: Select all

The solution is correct.
The solution is correct.
The solution is correct.
The solution is incorrect.
The solution is correct.
The solution is incorrect.
The solution is incorrect.
The solution is correct.
The solution is correct.
The solution is correct.
The solution is correct.
The solution is correct.
The solution is correct.
The solution is correct.
The solution is incorrect.
The solution is incorrect.

Posted: Thu May 04, 2006 3:24 am
by Quantris
Thanks for the info, but unfortunately mine matches up with that so far.

I'll keep trying :)

Posted: Thu May 04, 2006 3:48 am
by Quantris
If you still have your program around, can you check if adding spaces to the start of the solution line changes "correct" to "incorrect" or not?

Thank you,

Posted: Thu May 04, 2006 4:14 am
by Quantris
Never mind, I got AC.

I wrote it again from scratch, and I guess I have better habits now -- it looks like some of the words don't use 'u', 'r', 'd', or 'l' to specify the direction, and I get AC when such entries are ignored completely (my WA prog would write the first letter into the grid at least).

This is definitely an issue with the problem statement which says: "Given crossword will always be correct."

Hope this will help some others!

Posted: Sun Aug 12, 2007 1:19 pm
by warenix
Hi all,

Why is this input incorrect?

Code: Select all

alas 1 1 r
#
6
1
alas$
Oh, after trials and errors, I know the reason now. (AC!)

The key is on the true meaning of "minimal" :lol: