hey,
Test cases 1 and 2 are not getting passed.
please take a look at my code.
Piyush and magical park
#include using namespace std; //s = initial eergy //k = threshold energy void magical_park(char park[][1000], int m, int n, int k, int s){ bool success = true; for(int i=0; i<m; i++){ for(int j=0; j<n; j++){ char ch = park[i][j]; if(s<k){ success = false; break; } else if(ch == β*β) s += 5; else if(ch == β.β) s -= 2; else break; if(j != n-1) sβ; } } if(success){ cout<<βYesβ<<endl; cout<<s; } else cout<<βnoβ; } int main(){ int n,m,k,s; cin>>n>>m>>k>>s; char park[1000][1000]; for(int i=0; i<m; i++){ for(int j=0 ; j<n; j++){ cin>>park[i][j]; } } magical_park(park,m,n,k,s); return 0; }