10524 - Matrix Reloaded

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

Moderator: Board moderators

Dominik Michniewski
Guru
Posts: 834
Joined: Wed May 29, 2002 4:11 pm
Location: Wroclaw, Poland
Contact:

Post by Dominik Michniewski » Thu Jul 17, 2003 8:37 am

It looks like I made mistake in outputing :oops:
I realize (after changing code to take maximal element as pivot), that I have right values, but my matrix is transposed ... so I think that's my problem :oops::oops: I am sometimes so stupid ....

Thanks all for help. there is another problem, which learn me something :) and I must be more carefully ...

Best regards
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:

Post by Dominik Michniewski » Mon Jul 21, 2003 2:28 pm

Unfortunatly I've got WA many times .... I try many options, but still WA ...
Could anyone help me and post more test cases ?

Best gerads
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)

Per
A great helper
Posts: 429
Joined: Fri Nov 29, 2002 11:27 pm
Location: Sweden

Post by Per » Mon Jul 21, 2003 3:20 pm

Dominik, you should try this test case:

Code: Select all

1
5
It's always the simple things... :)

Dominik Michniewski
Guru
Posts: 834
Joined: Wed May 29, 2002 4:11 pm
Location: Wroclaw, Poland
Contact:

Post by Dominik Michniewski » Tue Jul 22, 2003 8:08 am

Thanks Per :) again and again :)
This was silly mistake .... very silly .... I misunderstood problem - I think that matrix 1x1has not inverse ....
Now I got Accepted :):)

Best regards
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)

anupam
A great helper
Posts: 405
Joined: Wed Aug 28, 2002 6:45 pm
Contact:

Post by anupam » Tue Jul 22, 2003 9:19 am

Hey hey hey!!!
Very easy!!!!!!!!!!!!! :lol:
"Everything should be made simple, but not always simpler"

Alexander Kozlov
New poster
Posts: 23
Joined: Sun Jun 15, 2003 4:45 pm
Location: Ukraine

10524 Matrix Reloaded after rejudgement

Post by Alexander Kozlov » Thu Aug 28, 2003 12:30 pm

I am totaly disorientated. My AC program gets WA now, but I have checked it many times.
What do the words "No pivoting is allowed" mean? Can somebody explain it or give us an example of input and output?
And what is the limit value for matrix elements?

THANKS!!

Dominik Michniewski
Guru
Posts: 834
Joined: Wed May 29, 2002 4:11 pm
Location: Wroclaw, Poland
Contact:

Post by Dominik Michniewski » Thu Aug 28, 2003 2:58 pm

It's easy !!
When in time of computing you analize row 3 nad matrix is i.e.:

1000
0100
0001
0010

your program must answer "not possible" - that's all . but you see that such matrix exist - you can exchange rows 3 and 4 and everything is ok :)
but in this problem - it's impossible :)

Best regards
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)

anupam
A great helper
Posts: 405
Joined: Wed Aug 28, 2002 6:45 pm
Contact:

Post by anupam » Thu Aug 28, 2003 7:37 pm

actually ,
i saw many to solve the problem using pivoting.
actually, pivoting is a special corrector method.
but when a method was not perticularly said
(when there are multiple method creting multiple answer),
it's not better or wise to use that method. use the simple,
not the complex if others are not said.
I am poor in English. I know. But i think
you all will understand what i want to say.
the line is added for just clarity.
The problem was given in the contest as a easy problem.
But thinking complex made it complex.
And, from the numerical methods' point of view,
there may be many methods producing different answer.
If other way is not said, it is better to use the simple.
And, like you, many questioned me whether to do it using
pivoting or not.
So, for clarity pivoting is removed(The mathod was not used
the first time, the line is just added,not any other change but some
tripical test cases.).
So check for tripical test cases and those who got wa can
easily get ac.
And sorry for the late.
It's for the server upgrading.
--
Anupam :oops:
"Everything should be made simple, but not always simpler"

Alexander Kozlov
New poster
Posts: 23
Joined: Sun Jun 15, 2003 4:45 pm
Location: Ukraine

Post by Alexander Kozlov » Thu Aug 28, 2003 9:36 pm

Thank you, Dominik!
Thank you, Anupam!

I got AC.

Larry
Guru
Posts: 647
Joined: Wed Jun 26, 2002 10:12 pm
Location: Hong Kong and New York City
Contact:

Post by Larry » Thu Aug 28, 2003 11:28 pm

Can someone post some cases that'll trip things up? Thanks.

Caesum
Experienced poster
Posts: 225
Joined: Fri May 03, 2002 12:14 am
Location: UK
Contact:

what?

Post by Caesum » Wed Oct 22, 2003 7:44 pm

This problem is really unclear. What on earth does 'no pivoting is allowed' mean ? Are you saying that:
all matrices are 2*2 or less, or diagonal ? If you calculate the inverse of a 2*2 matrix in general then surely you have used pivoting although it is not completely obvious ? Or are there things like general 3*3 matrices in the input and we should use the formula ? How far does this go ? What on earth is this problem really saying ?
I don't understand the example above at all, the matrix given has an inverse, is it necessary to use pivoting to find it ? Well...... no, it isn't since the matrix given is clearly self inverse........ help!!!!!!!

Per
A great helper
Posts: 429
Joined: Fri Nov 29, 2002 11:27 pm
Location: Sweden

Post by Per » Wed Oct 22, 2003 10:21 pm

The "no pivoting" comment says (or at least I assumed so, and got AC) that:

"Since we assume you're using the method of Gaussian elimination for inverting matrices, you are not, in this process, allowed to swap two rows (or two columns)."

For people who want to solve it some other way (some people have great imagination :)), well, good luck...

Larry
Guru
Posts: 647
Joined: Wed Jun 26, 2002 10:12 pm
Location: Hong Kong and New York City
Contact:

Post by Larry » Wed Oct 22, 2003 10:32 pm

Can someone post some inputs/outputs? I think my precision is not good enough. Thanks.

Caesum
Experienced poster
Posts: 225
Joined: Fri May 03, 2002 12:14 am
Location: UK
Contact:

Post by Caesum » Wed Oct 22, 2003 11:07 pm

Per: that still does not apply to the case above you can add row four to row three:
1000|1000
0100|0100
0001|0010
0010|0001

1000|1000
0100|0100
0011|0011
0010|0001

now subtract row three from row 4:

100 0|10 00
010 0|01 00
001 1|00 11
000-1|00-10

multiply row 4 by -1:
1000|1000
0100|0100
0011|0011
0001|0010

and subtract row 4 from row3:
1000|1000
0100|0100
0010|0001
0001|0010

so...........

Per
A great helper
Posts: 429
Joined: Fri Nov 29, 2002 11:27 pm
Location: Sweden

Post by Per » Wed Oct 22, 2003 11:42 pm

Yeah, OK, it's a question as to how you define Gaussian elimination.

The way I've usually seen it, you first have a "forward elimination" (direct translation of the swedish term, not sure if it's correct) phase where you make the matrix upper triangular. In this phase, you first add multiples of row 1 to rows 2..n, then multiples of row 2 to rows 3..n, and so on, and that's it: you never add a row to the rows above it. Then, similarly, there's the "backward elimination" phase to make the matrix lower triangular as well.

Post Reply

Return to “Volume 105 (10500-10599)”