10614 - Dreadful Vectors

All about problems in Volume 106. 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
Whinii F.
Experienced poster
Posts: 151
Joined: Wed Aug 21, 2002 12:07 am
Location: Seoul, Korea
Contact:

10614 - Dreadful Vectors

Post 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
JongMan @ Yonsei
Per
A great helper
Posts: 429
Joined: Fri Nov 29, 2002 11:27 pm
Location: Sweden

Post 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.
Per
A great helper
Posts: 429
Joined: Fri Nov 29, 2002 11:27 pm
Location: Sweden

Post by Per »

Looking closer, it seems your problem is that you compute cross-products incorrectly.
Whinii F.
Experienced poster
Posts: 151
Joined: Wed Aug 21, 2002 12:07 am
Location: Seoul, Korea
Contact:

Post 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 =)
JongMan @ Yonsei
Adrian Kuegel
Guru
Posts: 724
Joined: Wed Dec 19, 2001 2:00 am
Location: Germany

Post by Adrian Kuegel »

Are you removing all spaces? If yes, can your program handle this input:
2 3

Output: Bang!
Whinii F.
Experienced poster
Posts: 151
Joined: Wed Aug 21, 2002 12:07 am
Location: Seoul, Korea
Contact:

Post 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:
JongMan @ Yonsei
Corpse Fiend
New poster
Posts: 5
Joined: Wed Dec 17, 2003 6:18 pm
Location: Poland

Post by Corpse Fiend »

Can you please explain me the way of receiving cross-products? I don't understand it. :(
Whinii F.
Experienced poster
Posts: 151
Joined: Wed Aug 21, 2002 12:07 am
Location: Seoul, Korea
Contact:

Post 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).
JongMan @ Yonsei
windows2k
Experienced poster
Posts: 136
Joined: Sat Apr 05, 2003 3:29 pm
Location: Taiwan

Post 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 :)
Dominik Michniewski
Guru
Posts: 834
Joined: Wed May 29, 2002 4:11 pm
Location: Wroclaw, Poland
Contact:

Post 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
If you really want to get Accepted, try to think about possible, and after that - about impossible ... and you'll get, what you want ....
Born from ashes - restarting counter of problems (800+ solved problems)
Dominik Michniewski
Guru
Posts: 834
Joined: Wed May 29, 2002 4:11 pm
Location: Wroclaw, Poland
Contact:

Re: 10614 - Dreadful Vectors

Post 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 :-)
If you really want to get Accepted, try to think about possible, and after that - about impossible ... and you'll get, what you want ....
Born from ashes - restarting counter of problems (800+ solved problems)
red_apricot
New poster
Posts: 48
Joined: Sun Jun 22, 2014 6:14 am

Re: 10614 - Dreadful Vectors

Post 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!".
Post Reply

Return to “Volume 106 (10600-10699)”