878 - Rotating Tetris Pieces

All about problems in Volume 8. 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
sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

878 - Rotating Tetris Pieces

Post by sohel »

What is the upper limit of x and y, in this problem..

.. and since the range of this values play a significant role towards the algorithm, I think the range should have been given in the description.

ie. if x and y are in the range of [0,10] then a simple minded approach would suffice, but for range like[0,1000000000], paper work is required.

stubbscroll
Experienced poster
Posts: 151
Joined: Tue Nov 16, 2004 7:23 pm
Location: Norway
Contact:

Post by stubbscroll »

Whenever limits are not mentioned in the problem statement, always assume the worst, so assume [0, 2^31-1].

tobby
Learning poster
Posts: 98
Joined: Fri Dec 30, 2005 3:31 pm

Post by tobby »

Please tell me the correct format of input for this problem. According to problem statement:
coordinate pairs are separated by white-spaces
To me this suggest coordinate pairs come in a line. Is this correct? And are tabs considered white-spaces too?

Thank you.

mf
Guru
Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland
Contact:

Post by mf »

Whitespaces are spaces, tabs and newlines.

tobby
Learning poster
Posts: 98
Joined: Fri Dec 30, 2005 3:31 pm

Post by tobby »

Thank you.

I am getting WA. I think it should be because my code handles the input format wrongly. Can anyone help me by giving my some test cases?

I used this I/O: (. is a space and _ is a tab)

Code: Select all

8

10,10.11,10.12,10.12,11.12,12.11,12.10,12.10,11.-1,-1







2147483647,2147483647.2147483646,2147483647.
....
.......2147483644,2147483647





2147483645,2147483647._
...-1,-1

0,1..0,2..1,1..2,1.__.2,0..-1,-1

2147483647,2147483647.-1,-1

3,3......4,4..4,3
3,4.-1,-1

1,2.2,1.2,2.1,3.-1,-1

1,2.2,1.2,2.1,3.1,1.-1,-1

0,1.............................................................
..................................1,0...............................1,1________
.0,2__.0,0......
....-1,-1
Output

Code: Select all

4

2

2

4

4

2

1

1
Are they correct?

mf
Guru
Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland
Contact:

Post by mf »

I get:

Code: Select all

1

2

2

1

1

2

4

4
I am getting WA. I think it should be because my code handles the input format wrongly.
If you use scanf() to parse the input, you have nothing to worry about. It deals with whitespaces just fine.

tobby
Learning poster
Posts: 98
Joined: Fri Dec 30, 2005 3:31 pm

Post by tobby »

Thank you mf. As you can see my mistake is reading the problem statement wrongly, so I print 1 when the answer is 4, and 4 when the answer is 1. I change that and get accepted.

By the way, I use pascal so I have to do my own parsing.

Post Reply

Return to “Volume 8 (800-899)”