285 - Crosswords
Moderator: Board moderators
285 - Crosswords
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?
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?
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
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
-
- Guru
- Posts: 834
- Joined: Wed May 29, 2002 4:11 pm
- Location: Wroclaw, Poland
- Contact:
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
![;-)](./images/smilies/icon_wink.gif)
Best regards
DM
If you really want to get Accepted, try to think about possible, and after that - about impossible ... and you'll get, what you want ....
Born from ashes - restarting counter of problems (800+ solved problems)
Born from ashes - restarting counter of problems (800+ solved problems)
-
- Guru
- Posts: 834
- Joined: Wed May 29, 2002 4:11 pm
- Location: Wroclaw, Poland
- Contact:
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
you must report 'incorrect solution'. Why - try to think about ![;-)](./images/smilies/icon_wink.gif)
Best regards
DM
PS. Meaning of width/height in this problem isn't correct for me - and is far from reality![:(](./images/smilies/icon_frown.gif)
Code: Select all
alas 2 1 r
#
4
1
alas$
![;-)](./images/smilies/icon_wink.gif)
Best regards
DM
PS. Meaning of width/height in this problem isn't correct for me - and is far from reality
![:(](./images/smilies/icon_frown.gif)
If you really want to get Accepted, try to think about possible, and after that - about impossible ... and you'll get, what you want ....
Born from ashes - restarting counter of problems (800+ solved problems)
Born from ashes - restarting counter of problems (800+ solved problems)
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:
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$
-
- Experienced poster
- Posts: 151
- Joined: Tue Nov 16, 2004 7:23 pm
- Location: Norway
- Contact:
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:
Output:
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 $
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.
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!
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!
Hi all,
Why is this input incorrect?
Oh, after trials and errors, I know the reason now. (AC!)
The key is on the true meaning of "minimal"![:lol:](./images/smilies/icon_lol.gif)
Why is this input incorrect?
Code: Select all
alas 1 1 r
#
6
1
alas$
The key is on the true meaning of "minimal"
![:lol:](./images/smilies/icon_lol.gif)