11298 - Dissecting a Hexagon

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

Moderator: Board moderators

baodog
Experienced poster
Posts: 202
Joined: Wed Jul 04, 2007 6:53 am

No Illegal Characters

Post by baodog » Mon Oct 01, 2007 8:02 pm

There are no illegal characters!!!
You can read in character by character to check.

Does your code work for the following input :D

Code: Select all

-47534985748395743925734895374598347589345734895734895764
Notice there is no lower bound on n in the problem statement.

luishhh
New poster
Posts: 26
Joined: Mon Oct 25, 2004 8:11 pm
Location: Spain

Post by luishhh » Mon Oct 01, 2007 9:53 pm

In my opinion, your test case is completely insane. Problemsetters should care more about the problem statement than about making stupid input for the judge. I don't think you can be proud of making some people spent their time to get AC in this problem.
"From lost to the river" --> Spanish quote

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

Post by tobby » Tue Oct 02, 2007 3:45 am

luishhh wrote:In my opinion, your test case is completely insane. Problemsetters should care more about the problem statement than about making stupid input for the judge. I don't think you can be proud of making some people spent their time to get AC in this problem.
+1

User avatar
WingletE
New poster
Posts: 35
Joined: Sun Aug 13, 2006 1:34 pm
Location: Taipei, Taiwan
Contact:

Post by WingletE » Tue Oct 02, 2007 10:08 am

Thanks to sclo.
It's really the problem of cin.


such a stupid problem...

User avatar
sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

Post by sohel » Sat Oct 06, 2007 8:50 am

Why isn't it possible to make 0 parallelograms?
Just by making no dissection, we get 0 parallelogram!!!
baodog wrote: Notice there is no lower bound on n in the problem statement.
If the bound isn't clearly specified, what array size should we declare?

baodog
Experienced poster
Posts: 202
Joined: Wed Jul 04, 2007 6:53 am

Post by baodog » Sat Oct 06, 2007 9:35 am

1) The problem says "dissect/divide a regular hexagon into n parallelograms of equal area", not make.
This means that the entire area of the haxagon must be covered by the parallelograms!
In otherwords, sum of the area of the parallelograms = area of hexagon.
If you make no parallelograms, the total area of them sum to 0,
which is not equal to the area of the hexagon. In english, dissect actually
means cut ... and into means that the hexagon must no longer
exist after the cutting... the hexagon becomes n parallelograms.
If you make 0 parallelograms, then the hexagon still exist!!!

2) If the first non-space character is "-", then your should return 0.
You know that it is negative. The problem says "otherwise return 0".

User avatar
sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

Post by sohel » Sat Oct 06, 2007 10:00 am

baodog wrote:1) The problem says "dissect/divide a regular hexagon into n parallelograms of equal area", not make.
This means that the entire area of the haxagon must be covered by the parallelograms!
In otherwords, sum of the area of the parallelograms = area of hexagon.
If you make no parallelograms, the total area of them sum to 0,
which is not equal to the area of the hexagon. In english, dissect actually
means cut ... and into means that the hexagon must no longer
exist after the cutting... the hexagon becomes n parallelograms.
If you make 0 parallelograms, then the hexagon still exist!!!

2) If the first non-space character is "-", then your should return 0.
You know that it is negative. The problem says "otherwise return 0".
Thanks. Got it!!! :D

Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Re: No Illegal Characters

Post by Jan » Sat Oct 06, 2007 8:41 pm

baodog wrote:There are no illegal characters!!!
You can read in character by character to check.
Does your code work for the following input :D

Code: Select all

-47534985748395743925734895374598347589345734895734895764
Notice there is no lower bound on n in the problem statement.
Well, then I can say

Code: Select all

-10000000 ... 700000000 characters
Does the judge solution work for this case? Or times out for reading the input?

Of course there is no lower bound on n!!!
Ami ekhono shopno dekhi...
HomePage

baodog
Experienced poster
Posts: 202
Joined: Wed Jul 04, 2007 6:53 am

Post by baodog » Sat Oct 06, 2007 8:50 pm

Assume that the input file can be read well within
the time limit of 6 seconds. There are countless problems
in the archive that says "a number of inputs" or "read in a text".
It is assumed they can be read in within the time limit, and
many more where numerical precision is not specified (double, float
, or infinite?).
For practical purposes, it's impossible to even submit
such a large test file by email to the archive.

Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan » Sat Oct 06, 2007 9:18 pm

In c/c++ gets(), fread() are faster functions. So, a dataset can be made where your scanf() will time out in reading but gets() won't.

And of course this is not the proper way to set judge data. The reason is you shouldn't trick people in reading the dataset. A good problem can have tricks, and of course the tricks should make sense.

For this problem you can say that for n = 0 the answer is 0. And yes, its a nice trick cause we have to dissect the hexagon (you described already). But I am sorry to say that the negative integers are clearly non-sense for this problem. May be you should think a while, I am sure that you will come up to this conclusion, too.
Ami ekhono shopno dekhi...
HomePage

baodog
Experienced poster
Posts: 202
Joined: Wed Jul 04, 2007 6:53 am

Post by baodog » Sat Oct 06, 2007 10:28 pm

It's just a one time, experimental nasty trick to get newbie programmers to check data range more carefully. Nothing more. Does negative inputs make sense? Of course not :wink: . That's why the problem says "otherwise return 0". However, I won't use such tricks in the future.
Of course, the real story is that I was watching football and drinking beer after work when I made the dataset... but that's another story.

Post Reply

Return to “Volume 112 (11200-11299)”