Page **3** of **3**

### Re: 11349 - Symmetric Matrix

Posted: **Wed Jul 08, 2009 7:49 am**

by **sharath**

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

### Re: 11349 - Symmetric Matrix

Posted: **Thu Jul 09, 2009 1:10 pm**

by **mf**

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.

### Re: 11349 - Symmetric Matrix

Posted: **Mon Oct 26, 2009 10:51 am**

by **r2ro**

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`

### Re: 11349 - Symmetric Matrix

Posted: **Mon Jun 27, 2011 2:19 pm**

by **plamplam**

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

. 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:

The result for this one is non-symmetrical.

### Re: 11349 - Symmetric Matrix

Posted: **Fri Nov 30, 2012 10:01 pm**

by **shuvokr**

Remove after AC

### Re: 11349 - Symmetric Matrix

Posted: **Wed Feb 13, 2013 7:25 am**

by **brianfry713**

### 11349 - Symmetric Matrix why WA

Posted: **Mon Apr 22, 2013 1:32 am**

by **ahmed mohamed said**

#include <iostream>

using namespace std;

int main()

{

bool x = true;

int testcases;

cin>>testcases;

for(int t=1 ; t<=testcases; t++)

{

char Nu , eq ;

int N ;

cin>>Nu; cin>>eq ;cin>>N;

long** matrix = new long*[N];

for(int k = 0 ; k<N; k++)

matrix[k] = new long[N];

for(int i=0 ; i<N ; i++)

{

for (int j=0 ; j<N ; j++)

{

cin>>matrix*[j];*

}

}

for(int i=0 ; i<N ; i++)

{

for(int j=0 ; j<N ; j++)

{

if (matrix*[j] < 0 )*

{

x =false ;

break;

}

}

if(x == false)

break;

}

if (x==false)

{

cout<<"Test #"<<t<<": Non-symmetric."<<endl;

}

else

{

for(int i=0 ; i<N ; i++)

{

for(int j=0 ; j<N; j++)

{

if(matrix*[j] == matrix[N-(i+1)][N-(j+1)])*

x=true;

else

{

x=false;

break;

}

}

if(x == false)

break;

}

if(x)

cout<<"Test #"<<t<<": Symmetric."<<endl;

else

cout<<"Test #"<<t<<": Non-symmetric."<<endl;

}

for(int i=0 ; i<N ; i++)

delete []matrix*;*

delete []matrix;

}

return 0;

}

### Re: 11349 - Symmetric Matrix why WA

Posted: **Mon Apr 22, 2013 11:34 pm**

by **brianfry713**

Use long long.

### Re: 11349 - Symmetric Matrix

Posted: **Tue May 20, 2014 12:38 pm**

by **uDebug**

Here's some input I found useful during testing / debugging.

Input:

Code: Select all

```
8
N = 3
5 1 3
2 -5 2
3 1 5
N = 4
4294967296 87 1 3
2 88 2 21
21 2 88 2
3 1 87 4294967296
N = 1
-1
N = 1
66
N = 2
4 5
5 4
N = 5
5 1 3 2 99
2 5 2 1 2
987 77 66 78 987
2 1 2 5 2
99 2 3 1 5
N = 5
5 1 3 2 99
2 5 2 1 2
987 77 66 77 987
2 1 2 5 2
99 2 3 1 5
N = 5
5 1 3 2 99
2 5 2 1 2
987 77 -66 78 987
2 1 2 5 2
99 2 3 1 5
```

AC Output:

Code: Select all

```
Test #1: Non-symmetric.
Test #2: Symmetric.
Test #3: Non-symmetric.
Test #4: Symmetric.
Test #5: Symmetric.
Test #6: Non-symmetric.
Test #7: Symmetric.
Test #8: Non-symmetric.
```

### Re: 11349 - Symmetric Matrix

Posted: **Tue Jul 08, 2014 8:19 pm**

by **jokerz**

@ v1n1t

why case 6 is non-symmetric???

### Re: 11349 - Symmetric Matrix

Posted: **Tue Jul 08, 2014 8:22 pm**

by **jokerz**

v1n1t wrote:Here's some input I found useful during testing / debugging.

Input:

Code: Select all

```
8
N = 3
5 1 3
2 -5 2
3 1 5
N = 4
4294967296 87 1 3
2 88 2 21
21 2 88 2
3 1 87 4294967296
N = 1
-1
N = 1
66
N = 2
4 5
5 4
N = 5
5 1 3 2 99
2 5 2 1 2
987 77 66 78 987
2 1 2 5 2
99 2 3 1 5
N = 5
5 1 3 2 99
2 5 2 1 2
987 77 66 77 987
2 1 2 5 2
99 2 3 1 5
N = 5
5 1 3 2 99
2 5 2 1 2
987 77 -66 78 987
2 1 2 5 2
99 2 3 1 5
```

AC Output:

Code: Select all

```
Test #1: Non-symmetric.
Test #2: Symmetric.
Test #3: Non-symmetric.
Test #4: Symmetric.
Test #5: Symmetric.
Test #6: Non-symmetric.
Test #7: Symmetric.
Test #8: Non-symmetric.
```

why case 6 is non symmetric???

### Re: 11349 - Symmetric Matrix

Posted: **Wed Jul 09, 2014 9:46 pm**

by **brianfry713**

In the third row 77 != 78

### Re: 11349 - Symmetric Matrix

Posted: **Thu Jul 10, 2014 7:27 am**

by **uDebug**

jokerz wrote:why case 6 is non symmetric???

Repeating your question doesn't make someone answer it quicker.

brianfry713 wrote:In the third row 77 != 78

Thank you for helping make things clear.

### Re: 11349 - Symmetric Matrix

Posted: **Thu Jul 16, 2015 9:27 am**

by **Helaluddin_brur**

removed after ac