Page 1 of 1

10614 - Dreadful Vectors

Posted: Thu Feb 05, 2004 7:34 pm
by Whinii F.
I KNOW these kind of problems are extremely hard to get right, and I am an imprudent coder, but this one. :-?

Could you verify these IO set, or provide some tricky ones?
Input wrote:[[1,2,3]*[1,2,3],[1,2,3]*[1,2,3],[1,2,3]x[1,2,[1,2,3]*[1,2,3]]]
[[1,2,3]*[1,2,3],[1,2,3]*[1,2,3],[1,2,3]x[1,2,[1,2,3]*[1,2,3]]]x[123,1,1]
[1,2,3]x([1,3,2]*[2,3,5])
[1+(2+3)*4+(5*6),2,3]
[1,2,3] * 3
[1,2,3] + [4,5,6]
[ 1, 2, 3] * ( [4,15,6] * (2-1*1))
[1,2,3] x [4,5,6] x 2
[1, 2, 3, 4+5]
[1,1,1] * 0
[1,1,1] * [1,1,1]
[1,,2]
[1,[2,3,4]x[1+(3*6),3,4],7]*
[1,[4],7]
[4]
4+((((6*7+4)))
[1,[1,2,3]*[1,2,3]*[1,2,3]*[1,2,3]*4,7)
[1,([1,2,3]+[1,2,3])x[1,2,3],(19+19)+(19)]
[1,1,1]-([1,2,3]+[3,2,1])
(1,2,3)*(1,2,3)
([98,89,72]+[72,72,64]x[3,2,1])
[1,2,3]*[3,2,1]x[5,5,5]
[1,2,3]x[3,2,1]*[5,5,5]
#
Output wrote:[14,14,11]
-366
Bang!
[51,2,3]
[3,6,9]
[5,7,9]
52
Bang!
Bang!
[0,0,0]
3
Bang!
Bang!
Bang!
Bang!
Bang!
Bang!
[1,0,57]
[-3,-3,-3]
Bang!
Bang!
Bang!
[0,0,0]
Thanks in advance,
JongMan

Posted: Thu Feb 05, 2004 8:31 pm
by Per
Correct (or at least output of my AC program) output:

Code: Select all

Bang!
Bang!
Bang!
[51,2,3]
[3,6,9]
[5,7,9]
52
Bang!
Bang!
[0,0,0]
3
Bang!
Bang!
Bang!
Bang!
Bang!
Bang!
Bang!
[-3,-3,-3]
Bang!
[42,209,0]
Bang!
0
Two examples:

In the first case, you have something like [14,14, [22,-11,0]], which is clearly a Bang!

In the last case, you have [-4,8,-4]*[5,5,5], which is the scalar 0, not the vector.

Posted: Thu Feb 05, 2004 8:38 pm
by Per
Looking closer, it seems your problem is that you compute cross-products incorrectly.

Posted: Fri Feb 06, 2004 2:09 pm
by Whinii F.
Oh yes, my stupidity. I calculated cross products as a scalar. :oops:
After modifying that my program solves the case correcly, but I still get WA.. :cry: I'll try to fix it. Thanks a lot, anyway!

Sincerely,
JongMan =)

Posted: Fri Feb 06, 2004 2:35 pm
by Adrian Kuegel
Are you removing all spaces? If yes, can your program handle this input:
2 3

Output: Bang!

Posted: Fri Feb 06, 2004 3:48 pm
by Whinii F.
Splendid! I got accepted at once, so got a good take-home lesson. :)

Thanks a lot! I didn't even think about it. This problem was not as much "dreadful" as I thought. :wink:

Posted: Tue Feb 17, 2004 12:03 pm
by Corpse Fiend
Can you please explain me the way of receiving cross-products? I don't understand it. :(

Posted: Wed Feb 18, 2004 9:39 pm
by Whinii F.
A cross product of two vectors of size-three
(a, b, c) and (d, e, f) is (bf - ce, cd - af, ae - bd).

Posted: Sat Feb 21, 2004 8:31 am
by windows2k
Whinii F. wrote:A cross product of two vectors of size-three
(a, b, c) and (d, e, f) is (bf - ce, cd - af, ae - bd).
Hello, Whinii F.
I tried to solve the problem . and get WA.
I have paseed the sample input and the input above.
Could you give me more tricky input? thx :)

Posted: Sat Mar 10, 2007 10:08 pm
by Dominik Michniewski
I tried to solve this problem too, and got WA too...
In my opinion is simple parsing problem ... isn't it ?

Could anyone help me and some tricky cases ? I got right answers for IO from this thread ...

Best regads
DM

Re: 10614 - Dreadful Vectors

Posted: Wed May 11, 2011 9:30 am
by Dominik Michniewski
Finally I got it :)
It's a simple parsing problem, but I must use long int (instead of int) to get Accepted :-)

Re: 10614 - Dreadful Vectors

Posted: Fri Nov 21, 2014 10:16 am
by red_apricot
OK, so for cases like

Code: Select all

[1,2,3] * [4,5,6] x [7,8,9]
the output should be "Bang!", since the problem statement says "*" and "x" have the same priority. Just in case anyone is wondering.

EDIT: Hm, for

Code: Select all

-[1,2,3]
-1-2-3
one should output "Bang!" (according to uvatoolkit.com), although it is a perfectly OK vector, and my WA program outputs

Code: Select all

[-1,-2,-3]
-6
The funny thing is that I can't "downgrade" my seemingly correct program to handle this case...
Anyway, here is my WA code. Comments are appreciated.

Code: Select all

/*
 AC
EDIT: If there is an expression starting with '-', output "Bang!". This is illogical, e.g. for "-1-2" one would have to output "Bang!".