Page 2 of 2
No Illegal Characters
Posted: Mon Oct 01, 2007 8:02 pm
by baodog
There are no illegal characters!!!
You can read in character by character to check.
Does your code work for the following input
Code: Select all
-47534985748395743925734895374598347589345734895734895764
Notice there is no lower bound on n in the problem statement.
Posted: Mon Oct 01, 2007 9:53 pm
by luishhh
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.
Posted: Tue Oct 02, 2007 3:45 am
by tobby
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
Posted: Tue Oct 02, 2007 10:08 am
by WingletE
Thanks to sclo.
It's really the problem of cin.
such a stupid problem...
Posted: Sat Oct 06, 2007 8:50 am
by sohel
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?
Posted: Sat Oct 06, 2007 9:35 am
by baodog
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".
Posted: Sat Oct 06, 2007 10:00 am
by sohel
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!!!

Re: No Illegal Characters
Posted: Sat Oct 06, 2007 8:41 pm
by Jan
baodog wrote:There are no illegal characters!!!
You can read in character by character to check.
Does your code work for the following input
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!!!
Posted: Sat Oct 06, 2007 8:50 pm
by baodog
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.
Posted: Sat Oct 06, 2007 9:18 pm
by Jan
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.
Posted: Sat Oct 06, 2007 10:28 pm
by baodog
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

. 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.