t = int(input())
while t>0:
m , n = map(int , input().split())
x , y = map(int , input().split())
a , b = map(int , input().split())
Tt = n - x + m - y
Tp = max(n-a , m-b)
if Tp<Tt:
print("NO")
else:
print("YES")
t-=1
Can anyone tell me why am I getting WA? I am getting correct output with the given test case.
done it in python, got TLE, done it in cpp using the same logic, got AC : (
Can anyone explain why this solution is wrong
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t > 0) {
int size = sc.nextInt();
int pplsFirst = sc.nextInt();
int[] arr = new int[size];
for(int i=0;i<arr.length; i++) {
arr[i] = sc.nextInt();
}
int maxtillNow = pplsFirst;
int max = 0;
int i = 0;
while(i < size) {
maxtillNow += arr[i];
if(maxtillNow > max) {
max = maxtillNow;
}
i++;
}
System.out.println(max);
t--;
}
}
}