Here,is the problem link: Full Barrier Alchemist Practice Coding Problem - CodeChef
My code for the problem:
include
using namespace std;
int main() {
int t;
cin>>t;
while(t–)
{
long long n;
long long h;
long long y1;
long long y2;
long long l;
cin>>n>>h>>y1>>y2>>l;
long long cnt = 0;
while(n–)
{
int type;
int x;
cin>>type;
cin>>x;
if(type==1)
{
if(h-y1<=x)
{
cnt++;
}
else
{
cnt++;
l–;
if(l==0)
{
cnt–;
break;
}
}
}
else if(type==2)
{
if(y2>=x)
{
cnt++;
}
else
{
cnt++;
l--;
if(l==0)
{
cnt--;
break;
}
}
}
}
cout<<cnt<<endl;
}
return 0;
}
I am unable to find out failed test cases.Kindly,help me in that.