830 - Shark

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
10153EN
Experienced poster
Posts: 148
Joined: Sun Jan 06, 2002 2:00 am
Location: Hong Kong
Contact:

830 - Shark

Post by 10153EN »

I am trying on this problem, but got lots of WAs. I think I have checked for all conditions (at least I think :wink: ). Could anyone tell me if there's any tricky input exists?
Ivan Golubev
Experienced poster
Posts: 167
Joined: Fri Oct 19, 2001 2:00 am
Location: Saint Petersburg, Russia

Post by Ivan Golubev »

No tricks in this problem, check your code one more time.
User avatar
cytse
Learning poster
Posts: 67
Joined: Mon Sep 16, 2002 2:47 pm
Location: Hong Kong
Contact:

Post by cytse »

Just got AC, after 10+ WAs....
use getline instead of reading char by char
erdos
New poster
Posts: 32
Joined: Sat Jul 06, 2002 9:38 pm
Location: Lisbon
Contact:

Bug in shark last test case input

Post by erdos »

Hi,

There's a reason for so much errors while submiting Shark.
There's a bug in the last test case input.
The first line of each test tell us the number of lines and number of columns, unfortunately for last test case the input says there are 38 columns but in fact there are 39, that's why who's reading char by char
can have serious problems. (like I did...)
Fortunately this unsuspected column is just filled with dots so who's reading all line at once shouldn't have problems.

I had the opportunity to see the input files because the author of the problem is a teacher of mine.

Hope this helps.
Regards

Jose Santos
little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm

Post by little joey »

Well, it's more then that. There are either empty line where they shouldn't or no empty lines where they should or both. Only after ignoring them totaly I got AC.
smile2ka10
New poster
Posts: 13
Joined: Wed Oct 26, 2005 10:14 pm
Location: Iran
Contact:

Post by smile2ka10 »

According to what erdos said, i used this code and it got accepted:

Code: Select all

	for(cin>>n;n--;)
	{
		cin>>h>>w;
		if(!n)w=39;
except this i read normally from the input(char by char).
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 830 - Shark

Post by brianfry713 »

It looks like the input has been fixed. I read char by char without any of these workarounds and got AC.
Check input and AC output for thousands of problems on uDebug!
csegura
New poster
Posts: 5
Joined: Sun Apr 28, 2013 11:09 am

Re: 830 - Shark

Post by csegura »

I also had problems with the way of reading. I obtained wrong answer when reading character by character, but AC when reading line by line, so be careful...
Post Reply

Return to “Volume 8 (800-899)”