954 - Tetravex solver

All about problems in Volume 9. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
User avatar
little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm

954 - Tetravex solver

Post by little joey » Mon Nov 27, 2006 1:08 pm

I can't get this one accepted. I used the following assumptions:

- Every case in the input consists of exactly 16 strings. Although cases are separated by a blank line, blank lines may also be present within a case's input, so this is no help.

- If an input string has more than 4 characters, the input is invalid.

- Pieces can not be rotated, but must have the orientation given in the input.

I observed (via asserts) that the total number of strings in the input is divisible by 16; the total number of non-space characters is not divisible by 64.

Here is my code:

Code: Select all

REMOVED AFTER AC
Last edited by little joey on Wed Nov 29, 2006 11:39 am, edited 1 time in total.

User avatar
rio
A great helper
Posts: 385
Joined: Thu Sep 21, 2006 5:01 pm
Location: Kyoto, Japan

Post by rio » Mon Nov 27, 2006 2:43 pm

I did't assume that every case in the input consists of exactly 16 strings,
and assumed that blank line doesn't appear inside case.

There seems a case with more than 16 strings. I checked it with assert().

"Piece do not rotate", is right.

I hope this helps.
----
Sory for my poor English

User avatar
little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm

Post by little joey » Wed Nov 29, 2006 11:41 am

Thanks, rio.
Parsing the input is the hardest part of this problem (for me).

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 954 - Tetravex Solver

Post by brianfry713 » Sat Apr 07, 2012 12:25 am

To get AC:
For each test case: read lines until there is a blank line (at least one char that isn't white-space) or EOF.
If you don't read any lines, then terminate.

So for this input:

Code: Select all

0


0
The AC output is:

Code: Select all

0
Note that there are two blank lines between the input cases.
Check input and AC output for thousands of problems on uDebug!

Post Reply

Return to “Volume 9 (900-999)”