my code is giving the correct answer when compling and testing which is 13.
but none of the test case are correct. thats what it shows.
#include
using namespace std;
void magicalpark(char a[][1000],int n,int m,int k,int s)
{
bool success=true;
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
char ch=a[i][j];
if (s < k) {
success = true;
break;
}
if (ch == '*') {
s += 5;
} else if (ch == '.') {
s -= 2;
} else {
break;
}
if (j != m- 1)
s--;
else {
break;
}
}
}
if(success)
{
cout<<"yes"<<endl;
cout<<s;
}
else
{
cout<<"failed";
}
}
int main() {
int n,m,k,s;
cin>>n>>m>>k>>s;
char park [1000][1000];
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
cin>>park[i][j];
}
}
magicalpark(park,n,m,k,s);
return 0;
}