Page 2 of 3
Re: 11349 - Symmetric Matrix
Posted: Mon Jun 02, 2008 11:01 am
by rio
amr saqr wrote:Actually, I'm having problems with understanding the problem description,
should i cut the matrix vertically or horizontally to make the comparison to check whether it's symmetric or not ????
sorry but I'm little confused here
and thanx in advance
No, you don't have to.
If the matrix is like:
then you have to check;
Code: Select all
All the values are non-negative and a==p && b==o && c==n && ..
-----
Rio
Re: 11349 - Symmetric Matrix
Posted: Mon Jun 02, 2008 12:31 pm
by Obaida
Removed
Why WA?????[:(]....its killing me
Posted: Sat Jun 21, 2008 2:55 pm
by Chirag Chheda
Re: 11349 - Symmetric Matrix
Posted: Sun Jun 22, 2008 8:52 am
by emotional blind
Hi Chirag Chheda,
I think you should remove this line
And another thing, you should initialize f=false.
Re: 11349 - Symmetric Matrix
Posted: Sun Jun 22, 2008 10:31 am
by Chirag Chheda
Thank you sir for replying.
I made the changes suggested by you. But still i am getting WA.
And as far as system("pause") is concerned the judge dont give WA for that as in all my submissions
i send the code without removing it.
Waiting for your reply
Re: 11349 - Symmetric Matrix
Posted: Mon Jun 23, 2008 5:42 am
by emotional blind
Look at the definition -
Definition: Symmetric matrix is such a matrix that all elements of it are non-negative and symmetric with relation to the center of this matrix. Any other matrix is considered to be non-symmetric.
Please ensure all the things of this definition.
Re: 11349 - Symmetric Matrix
Posted: Mon Jun 23, 2008 7:41 am
by Chirag Chheda
Thank you sir..
finally i managed to get an ACC
Re: 11349 - Symmetric Matrix
Posted: Wed Jul 02, 2008 12:51 pm
by Obaida
But can someone explain why i am RTE.
>>my code is posted above.

Re: 11349 - Symmetric Matrix
Posted: Wed Jul 02, 2008 2:16 pm
by Chirag Chheda
Can u tell me y r u printing this line???
I think that's shud be in the input part and not the output part.
change it to:-
declare 'c' to be of char data type
Re: 11349 - Symmetric Matrix
Posted: Wed Jul 02, 2008 2:37 pm
by Obaida
Thank you very much. I always make such stupid mistake

.
I never thought i should be inputed and getting RTE.
Again thank you for quick reply.
Re: 11349 - Symmetric Matrix
Posted: Sun Jul 20, 2008 6:29 pm
by A. M. Santos R.
I think the problem statement is unclear:
Elements of this matrix are Mij: {0 < i < n, 0 < j < n}.
It should be Mij: {1 <= i <= n, 1 <= j <= n}.

Re: 11349 - Symmetric Matrix
Posted: Tue Jun 30, 2009 12:56 pm
by sharath
#include <stdio.h>
int main ()
{
int num_test, k, n, i, j, flag;
long long a[110][110];
char junk;
scanf ("%d", &num_test);
k = 0;
NEXT_CASE:
while (k++ < num_test)
{
fflush (stdin);
scanf ("%c %c %d", &junk, &junk, &n);
flag = 0;
for (i = 0;i < n; i ++)
{
for (j = 0;j < n;j ++)
{
scanf("%lld", &a
[j]);
if (a[j] < 0)
{
printf ("Test #%d: Non-symmetric.\n", k);
flag = 1;
}
}
}
if (flag)
{
continue;
}
for (i = 0;i < n/2; i ++)
{
for (j = 0;j < n;j ++)
{
if (a[j] != a[n - i - 1][n - j - 1])
{
printf ("Test #%d: Non-symmetric.\n", k);
goto NEXT_CASE;
}
}
}
for (j = 0;j < n/2; j ++)
{
for (i = 0;i < n;i ++)
{
if (a[j] != a[n - i - 1][n - j - 1])
{
printf ("Test #%d: Non-symmetric.\n", k);
goto NEXT_CASE;
}
}
}
printf ("Test #%d: Symmetric.\n", k);
}
return 0;
}
Can someone please let me know what is wrong in the above code...I am getting RTE 
Re: 11349 - Symmetric Matrix
Posted: Fri Jul 03, 2009 1:18 am
by kbr_iut
U need to read the input carefully.
suppose input is like
first, u r taking 1 with
that is okay.
then u r using
Code: Select all
scanf ("%c %c %d", &junk, &junk, &n);
Can u tell what will be the valu of junk and n here?
junk='\n'
junk='N'
n=garbage........
u can use this
or
Re: 11349 - Symmetric Matrix
Posted: Tue Jul 07, 2009 11:05 am
by sharath
@kbr_iut :
I have used fflush(stdin) before the statement scanf ("%c %c %d", &junk, &junk, &n); So the new line character would be flushed and n will have the value 3 for the input you have mentioned. Am I correct?
Re: 11349 - Symmetric Matrix
Posted: Tue Jul 07, 2009 5:58 pm
by kbr_iut
I just copied ur code and run for sample input of this problem and ur code gives
Code: Select all
Test #1: Symmetric.
Test #2: Symmetric.
and try to use code tag to post codes.