#include<bits/stdc++.h>
using namespace std;
int main() {
int m,n,k,s,i,j,flag=1;
cin>>m>>n>>k>>s;
char a[m][n];
for(i=0;i<m;i++)
for(j=0;j<n;j++)
cin>>a[i][j];
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
if(a[i][j]==β#β)
break;
if(a[i][j]==β.β&&j!=n-1)
{
s=s-3;
}
else if(a[i][j]==β.β&&j==n-1)
{
s=s-2;
}
if(s<k)
{
flag=0;
i=m;
j=n;
break;
}
if(a[i][j]==ββ&&j!=n-1)
{
s=s+4;
}
else if(a[i][j]==ββ&&j==n-1)
{
s=s+5;
}
}
}
if(flag==0)
cout<<βNoβ;
else
cout<<βYesβ;
return 0;
}
i dont know whats wrong in the code i am getting wrong answer in 2 test cases but 3 test cases are showing as correct
2 test cases are not satisfying
Hi @ArshjitSingh
At the end when piyush gets out of the park then along with yes you need to print s also. So just print s in next line when you are printing βYesβ.
Here is your corrected code :
If your doubt is clear then mark it as resolved.
I hope Iβve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.