11349 - Symmetric Matrix

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

Moderator: Board moderators

Re: 11349 - Symmetric Matrix

Postby sharath » Wed Jul 08, 2009 7:49 am

Surprisingly executing the same code in my windows XP PC gives the proper output and I think it is because of fflush(stdin) statement which is platform dependent. So for the platforms not supporting fflush (stdin) the input logic fails and hence the code. Thanks for pointing it out, I changed the input logic and got AC :)
sharath
New poster
 
Posts: 6
Joined: Tue Sep 16, 2008 9:21 pm

Re: 11349 - Symmetric Matrix

Postby mf » Thu Jul 09, 2009 1:10 pm

fflush(stdin) is a no-op in every sane programming environment, because fflush is only supposed to flush stream's *output* buffers.

But Microsoft's runtime library went totally nuts and defines it as discarding stream's input buffer as well. Well, usually it is a mistake to want to discard input buffers – or you'll risk throwing away the stuff you care about. Remember that the judge gives you the whole input at once from a file. Nobody's sitting there and typing the input line-by-line, as you might do in your own environment.
mf
Guru
 
Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland

Re: 11349 - Symmetric Matrix

Postby r2ro » Mon Oct 26, 2009 10:51 am

This problem is not difficult, but I cannot seem to get ACC. (WA always).

Here's my code, kindly check it out?

Code: Select all
Accepted. I was forgetting the '.' at the end xD
r2ro
New poster
 
Posts: 17
Joined: Thu Sep 25, 2008 9:26 am

Re: 11349 - Symmetric Matrix

Postby plamplam » Mon Jun 27, 2011 2:19 pm

Ahh....very tricky and very nice :) The range of the integers are 2^32 <= Mij <= 2^32, so you must use long long int. I got Wrong Answer twice because of this :-? :oops: . And remember to include a '.' at the end of all your results. Also remember that if any of the numbers is negative, then the matrix is non-symmetrical. For example:

Code: Select all
1
N = 3
-5 -1 -3
-2 0 -2
-3 -1 -5

The result for this one is non-symmetrical.
You tried your best and you failed miserably. The lesson is 'never try'. -Homer Simpson
User avatar
plamplam
Experienced poster
 
Posts: 151
Joined: Fri May 06, 2011 11:37 am

Re: 11349 - Symmetric Matrix

Postby shuvokr » Fri Nov 30, 2012 10:01 pm

Remove after AC :D
shuvokr
New poster
 
Posts: 28
Joined: Tue Oct 02, 2012 8:16 pm

Re: 11349 - Symmetric Matrix

Postby brianfry713 » Wed Feb 13, 2013 7:25 am

Input:
Code: Select all
1
n = 1
-1
Correct output:
Code: Select all
Test #1: Non-symmetric.
brianfry713
Guru
 
Posts: 1755
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Previous

Return to Volume CXIII

Who is online

Users browsing this forum: No registered users and 1 guest