my code is passing sample test cases ,but in rest of test cases it is showing run time error !!. Please help me …
#include
using namespace std;
int main()
{
int m,n,k,s;
cin>>m>>n>>k>>s;
char arr[100][100];
for(int i=0;i<m;i++)
{
for(int j=0;j<n;j++)
{
cin>>arr[i][j];
}
}
for(int i=0;i<m;i++)
{
for(int j=0;j<n;j++)
{
if(arr[i][j]=='#')
{
m++;
}
if(arr[i][j]=='.')
{
s=s-2;
s--;
}
if(arr[i][j]=='*')
{
s=s+5;
s--;
}
if(arr[i][j]<0)
break;
}
}
if(s>=k)
{
cout<<"Yes"<<endl<<s<<endl;
}
else if(s<k)
cout<<"No"<<endl;
return 0;
}