Ambiguous problem statement in December Cook-Off 2014

Humble request to the problem setter of problem “Matrix Again” in December cook-off:
At least make the problem statements clear so that everyone can understand it, or give good example. if not at least reply when clarification is asked.Everything you guys considered as cheating which might be not!

18 Likes

And also another humble request don’t write constraints as 0 <= |A(i, j)| <= 100 . Please write them as -100 <= A(i, j) <= 100. Was figuring out my mistake for whole time while my initial logic was correct. Missed this mod sign. -_-

9 Likes

Yeah that was a bit difficult to understand in the beginning. But please understand that apart from coding and implementation, understanding the question is also tested in competitive coding, and practicing in codechef really improves all our skills. So the problem setter has in one way done a good job only, because we get more experience on UNDERSTANDING questions.

6 Likes

same happened with me

matrix pratice link plz

Though I am not the problem setter, I can give you a small piece of advice. Get used to problem statements which are not clear. I know it can be hard and irritating, but that is the way it is. There have been plenty of questions which sometimes are really easy but understanding what is being asked for can be hard due the language. Although, in this problem, the language wasn’t exactly that bad. The reason why you probably found it hard was that it is a competition and you tend to read really fast through the question. You tend to expect to understand it in one go. However, you must try and avoid it. In problems like these where you don’t get it in one go, try reading it 2-3 times slowly and see what they are trying to convey. This problem when read carefully is infact very clear in what it is asking for. You just need to frame the problem with the notations and the inequalities that have been provided.

For Eg :
Consider every possible vector v of m elements, such that every 1 ≤ vi ≤ n.

Small line, but need to understand it step by step.
v is a vector of size m.
“Every vi is in [1,n] meaning, 1 ≤ v1 ≤ n, 1 ≤ v2 ≤ n, … 1 ≤ vm ≤ n”

“And every possible vector like this”… meaning there are going to be n^m
That is, possible vectors are (1,1,1,…m times) ,(1,1,1… m-1 times , 2) … and so on.

Next,
Let value of the vector be product of all Avi, i (1 ≤ i ≤ m). You are to count the sum of values over all possible vectors v.

Once again, you need to understand what is being conveyed here. The math behind it. A couple of sentences of english have been compressed into one solid notation, all Avi, i (1 ≤ i ≤ m).

Once you understand the problem and crack the logic, the only thing left was spotting the negative products. I guess many people got wrong answers thanks to this. I got two wrongs answers , first one thanks to the mod value which I took as 10^9 + 7.Got WA. Thought WA was only because of the wrong mod. Submitted with 10^7+7. Got WA again. Realized I overlooked this line in a hurry :
"Output single integer — the answer for the problem modulo 10^7 + 7, i.e the smallest non-negative integer number r that answer - r is divisible by 10^7 + 7 "
Added a line and got AC. Small mistakes. 40 minutes penalty.

Now whose fault is it if we get so many WA?
For this problem, it definitely is us to blame. Though you can argue why include such small tricks which many fail to miss. I guess it is part of the learning process and you better get used to it. Be happy you did not face this in a live contest. Read the problem thoroughly. Line by line. Word by word. You should be able to tackle such hurdles.

Cheers

6 Likes

Moduling negative numbers and the effect on multiplication: this is a normal thing. Check the sign after moduling all the time if you don’t want to risk WAs.

1 Like

Also faced the problem regarding mod of negative number statement.

1 Like

You should have understood the test case first

@ashish1610 same here

1 Like

how did that affect?? can u explain

Don’t write constraints as 0 <= |A(i, j)| <= 100 . Please write them as -100 <= A(i, j) <= 100.

This is the least they can do, can’t they?

That is ok to some extent but here even a good example was not mentioned.

2 Likes

each value while multiplying will be negative… which is wrong. The result should have been -val+mod

@king_of_hacker

Nicely said, like your comment.

2 Likes

this is what I do all the time…but even if there are no -ve numbers involved, sometimes i get a -ve ans when I use mod.Why?

@king_of_hacker if you are doing ans%c then to ignore whether ans is negative or positive use: (ans%c +c)%c
it will always give you the right answer

it was purposely there to fool our eyes that’s the main reason for such a low accuracy for the problem

good advice man… “reading the statement again”… i was initially confused why did they EXPLICITLY define the modulus operation in the problem statement… then i later realized, they wanted to convey that the o/p should be non-negative… but even when this was quite prominent in the problem statement, people missed it