I’ve just edited that post as the testcase contained some extra whitespace that caused your solution to choke, so make sure you’re using the updated testcase to debug
Exact replica for your Python 2 code in Python 3 does not work. I mean it gives runtime error. Please help!
T = int(input())
for i in range(T):
X,Y,K,N = map(int, input().split(’ ‘))
books = []
for k in range(N):
p,c = map(int, input().split(’ '))
books.append((p,c))
for p,c in books:
if p>=(X-Y) and c<=K:
print(‘LuckyChef’)
break
else:
print(‘UnluckyChef’)
int main() {
int i,t,x,y,k,n,p,c,j=0;
cin>>t;
for(int i=0;i<t;i++)
{cin>>x>>y>>k>>n;
bool found=false;
for(int i=0;i<n;i++)
{cin>>p>>c;
if(p>=x-y&&c<=k)
{found=true;
break;
}}
cout<<(found?“LuckyChef”:“UnluckyChef”)<<endl;}
return 0;
}
Please help me.
When i run the program it runs successfully but on submission shows wrong answer.
Can somebody please point out the mistakes.
The only difference I see in the array for cost and pages. int P[111111];
int C[111111]; how does This give the correct answer please explain if you get to know.
The only difference I see in the array for cost and pages. int P[111111];
int C[111111]; how does This give the correct answer please explain if you get to know.