Question : Log In | HackerEarth
My solution(WA) : “4hU83P - Online C++0x Compiler & Debugging Tool - Ideone.com”
My solution(AC) : “7zqZ0S - Online C++0x Compiler & Debugging Tool - Ideone.com”
I got 98 in contest too , and same in practice also I m not able to figuring out where my code wrong , also sometime it will give WA at TC 11 , and sometime it’s WA on TC 14 , may be some compiler or run time error issue.
@ssjgz @cubefreak777 @dhruv788
2 3
110
100
Correct output: 0
Your output: 1
2 Likes
Thanks , I just changed -
for(int i=0;i<m;i++)
{
if(a[0][i]==0)
dp[0][i] = 1;
else
dp[0][i] = 0;
}
for(int i=0;i<n;i++)
{
if(a[i][0]==0)
dp[i][0]=1;
else
dp[i][0]=0;
}
TO
for(int i=0;i<m;i++)
{
if(a[0][i]==0 and a[0][0]==0)
dp[0][i] = 1;
else
dp[0][i] = 0;
}
for(int i=0;i<n;i++)
{
if(a[i][0]==0 and a[0][0]==0)
dp[i][0]=1;
else
dp[i][0]=0;
}
It passed 
1 Like