Problem:


Score : 200 points

Problem Statement

Our world is one-dimensional, and ruled by two empires called Empire A and Empire B.

The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.

One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.

If there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.

X < Z \leq Y

x_1, x_2, ..., x_N < Z

y_1, y_2, ..., y_M \geq Z

Determine if war will break out.

Constraints

All values in input are integers.

1 \leq N, M \leq 100

-100 \leq X < Y \leq 100

-100 \leq x_i, y_i \leq 100

x_1, x_2, ..., x_N \neq X

x_i are all different.

y_1, y_2, ..., y_M \neq Y

y_i are all different.

Input

Input is given from Standard Input in the following format:

N M X Y
x_1 x_2 ... x_N
y_1 y_2 ... y_M

Output

If war will break out, print War; otherwise, print No War.

Sample Input 1

3 2 10 20
8 15 13
16 22

Sample Output 1

No War

The choice Z = 16 satisfies all of the three conditions as follows, thus they will come to an agreement.

X = 10 < 16 \leq 20 = Y

8, 15, 13 < 16

16, 22 \geq 16

Sample Input 2

4 2 -48 -1
-20 -35 -91 -23
-22 66

Sample Output 2

War

Sample Input 3

5 3 6 8
-10 3 1 5 -100
100 6 14

Sample Output 3

War



Sample input:
3 2 10 20
8 15 13
16 22


Sample output:
No War

Submission status: Wrong Answer

Solution code:
N, M, X, Y = list(map(int, input().split()))
x = list(map(int, input().split()))
x.sort()
y = list(map(int, input().split()))
y.sort()

if x[N-1] >= Y:
    print ('War')
elif y[0] <= X:
    print ('War')
elif x[N-1] > y[0]:
    print ('War')
else:
    print ('No War')

Submission status: Wrong Answer

Solution code:
import numpy as np
N,M,X,Y = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
if np.max(x) < np.min(y) and X < Y:
	print("No War")
else:
	print("War")

Submission status: Wrong Answer

Solution code:
N, M, X, Y = list(map(int, input().split()))

x = list(map(int, input().split()))
y = list(map(int, input().split()))

x.sort(reverse=True)
y.sort()

if x[0] < y[0]:
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

Solution code:
n,m,x,y =map(int,input().split())
a =map(int,input().split())
b = map(int,input().split())

a = max(a)
b = min(b)
if x < b and y > a:
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

Solution code:
a = raw_input().strip().split()
[n,m,X,Y] = [int(i) for i in a]
x = raw_input().strip().split()
x = [int(i) for i in x] + [X]
y = raw_input().strip().split()
y = [int(i) for i in y] + [Y]
x_m = max(x)
y_m = min(y)
if (x_m < y_m):
	print("No war")
else:
	print("War")

Submission status: Wrong Answer

Solution code:
a = raw_input().strip().split()
[n,m,x,y] = [int(i) for i in a]
x = raw_input().strip().split()
x = [int(i) for i in x]
y = raw_input().strip().split()
y = [int(i) for i in y]
x_m = max(x)
y_m = min(y)
if (x_m < y_m and x <= x_m and y>=y_m):
	print("No war")
else:
	print("War")

Submission status: Wrong Answer

Solution code:
import sys

def main():
    N, M, X, Y = map(int, input().split())
    x = list(map(int, input().split()))
    y = list(map(int, input().split()))
    ans = "War"

    z = X
    while z <= Y:
        z += 1
        if max(x) < z <= min(y):
            ans = "No War"

    print(ans)

main()

Submission status: Wrong Answer

Solution code:
import sys
n, m, x, y = map(int, input().split())
lineA = list(map(int, input().split()))
lineB = list(map(int, input().split()))
maxA = max(lineA)
minB = min(lineB)
if maxA >= minB:
    print("War")
else:
    for i in range(x + 1, y):
        if maxA < i and i <= minB:
            print("No War")
            sys.exit(0)
print("War")

Submission status: Wrong Answer

Solution code:
n,m,a,b=map(int,input().split())
X=[]
Y=[]
X = list(map(int, input().strip().split(' ')))
Y = list(map(int, input().strip().split(' ')))
if a>b:
    if min(X)>=max(Y) and a not in Y and b not in X:
        print("No War")
    else:
        print("War")
else:
    if min(Y)>=max(X) and a not in Y and b not in X:
        print("No War")
    else:
        print("War")

Submission status: Wrong Answer

Solution code:
import sys
n, m, x, y = map(int, input().split())
lineA = list(map(int, input().split()))
lineB = list(map(int, input().split()))
maxA = max(lineA)
minB = min(lineB)
print("%d %d"%(maxA, minB))
if maxA >= minB:
    print("War")
else:
    for i in range(x + 1, y):
        print(i)
        if maxA < i and i <= minB:
            print("No War")
            sys.exit(0)
print("War")

Submission status: Wrong Answer

Solution code:
n,m,a,b=map(int,input().split())
X=[]
Y=[]
X = list(map(int, input().strip().split(' ')))
Y = list(map(int, input().strip().split(' ')))
if a>b:
    if min(X)>max(Y) and a not in Y and b not in X:
        print("No War")
    else:
        print("War")
else:
    if min(Y)>max(X) and a not in Y and b not in X:
        print("No War")
    else:
        print("War")

Submission status: Wrong Answer

Solution code:
import numpy as np
 
XY = np.asarray(input().split(), dtype=int)
X = np.asarray(input().split(), dtype=int)
Y = np.asarray(input().split(), dtype=int)
 
if np.sum(X==XY[2]) == 1 or np.sum(Y==XY[3]) == 1:
    print("no War")
elif np.max(X) <= np.min(Y):
    print("no War")
else:
    print("War")

Submission status: Wrong Answer

Solution code:
I=lambda:[int(i) for i in input().split()]
n,m,x,y=I()
a=sorted(I())
b=sorted(I())
t=b[-m]
if x<t<=y and sum(1 for i in a if i<=t)>=n:
  print('No War')
else:
  print('War')

Submission status: Wrong Answer

Solution code:
N, M, X, Y = map(int, input().split())
x_values = list(map(int, input().split()))
x_values = list(filter(lambda Z: X < Z, x_values))
y_values = list(map(int, input().split()))
y_values = list(filter(lambda Z: Z <= Y, y_values))

answer = "War"
total = x_values + y_values

def min_max(x_val, y_val):
    if x_val: x = max(x_val)
    else: x = 0
    if y_val: y = min(y_val)
    else: y = 0
    return x, y

x, y = min_max(x_values, y_values)

for z in total:    
    if x < z <= y:
        answer = "No War"
        print(answer)
        exit()
print(answer)

Submission status: Wrong Answer

Solution code:
N, M, X, Y = map(int, input().split())
x_values = list(map(int, input().split()))
x_values = list(filter(lambda Z: X < Z, x_values))
y_values = list(map(int, input().split()))
y_values = list(filter(lambda Z: Z <= Y, y_values))

answer = "War"
total = x_values + y_values

for Z in total:
    x_number = list(filter(lambda x: x < Z, x_values))
    y_number = list(filter(lambda y: Z <= y, y_values))
    if x_number and y_number:
        answer = "No War"
        print(answer)
        exit()
print(answer)

Submission status: Wrong Answer

Solution code:
n, m, X, Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
flg = 1
for z in range(X, Y + 1):
    if max(x) < z <= min(y):
        print("No War")
        flg = 0
        break
if flg:
    print("War")

Submission status: Wrong Answer

Solution code:
n, m, X, Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
flg = 1
for z in range(X, Y + 1):
    if max(x) <= z <= min(y):
        print("No War")
        flg = 0
        break
if flg:
    print("War")

Submission status: Wrong Answer

Solution code:
n, m, X, Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
flg = 1
for z in range(X, Y + 1):
    if max(x) <= z < min(y):
        print("No War")
        flg = 0
        break
if flg:
    print("War")

Submission status: Wrong Answer

Solution code:
iptA=list(map(int,input().split()))
X=list(map(int,input().split()))
Y=list(map(int,input().split()))
X.append(iptA[2])
Y.append(iptA[3])
     
xmax,ymax=max(X),max(Y)
if xmax>=ymax:
    print('War')
else:
    print('No War')

Submission status: Wrong Answer

Solution code:
def main():
    M, N, X, Y = map(int, input().split())

    xs = list(map(int,input().split()))
    ys = list(map(int,input().split()))
    xy = []

    for n in range(X+1,Y):
        xy.append(n)

    if len(xy) == 0:
        print("War")
        return 0

    xMax = max(xs)
    yMin = min(ys)
    nMax = max(xy)
    nMin = min(xy)

    if xMax >= nMin:
        print("War")
        return 0

    if yMin < nMax:
        print("War")
        return 0

    print("No War")



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
if max(X, max(x)) < min(Y, min(y)):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
a, b, c, d = map(int, input().split())
if 10>a>1:
    print("War")
elif c>10:
    print("No War")
elif d>10:
    print("War")
elif b>0:
    print("No War")
else:
    print("No War")

Submission status: Wrong Answer

Solution code:
n,m,x,y=map(int,input().split())
arr1=list(map(int,input().split()))
arr2=list(map(int,input().split()))
if(x>=y):
	print("War")
elif(max(arr1)>=min(arr2)):
	print("War")
else:
	print("No War")

Submission status: Wrong Answer

Solution code:
N,M,X,Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

if max(x)<min(y):
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

Solution code:
#110b
n,m,x,y=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
z=abs(x-y)
flag=True

for i in range(z+1):
    if max(a)<x and min(b)>=x:
        break
    else:
        x+=i
        flag=False
print('No War' if flag else 'War')

Submission status: Wrong Answer

Solution code:
#110b
n,m,x,y=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
z=abs(x-y)
flag=True

for i in range(z+1):
    if max(a)<x and min(b)>=x:
        break
    else:
        x+=1
        flag=False
print('No War' if flag else 'War')

Submission status: Wrong Answer

Solution code:
#110b
n,m,x,y=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
z=abs(x-y)
flag=True

for i in range(z):
    if max(a)<x and min(b)>=x:
        break
    else:
        x+=1
        flag=False
print('No War' if flag else 'War')

Submission status: Wrong Answer

Solution code:
#110b
n,m,x,y=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
z=x-y
flag=True

for i in range(z):
    if max(a)<x and min(b)>=x:
        break
    else:
        x+=1
        flag=False
print('No War' if flag else 'War')

Submission status: Wrong Answer

Solution code:
N,M,X,Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

if X<Y and max(x)<min(y):
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

Solution code:
N,M,X,Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

if X<Y and max(x)>min(y):
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

Solution code:
N,M,X,Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

if X<Y or max(x)>min(y):
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

Solution code:
N, M, X, Y = map(int, input().split())
 
x = list(map(int, input().split()))
y = list(map(int, input().split()))
 
x.sort()
x.reverse()
y.sort()

c = 0

for i in range(x[0]+1, y[0]+1):
    if (X < i) and (i <= Y) and (x[0] < i) and (y[0] >= i):
        c = 1
        break
        
if c == 0:
    print("War")
else:
    print("No war")

Submission status: Wrong Answer

Solution code:
N,M,X,Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

if max(x)>min(y):
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

Solution code:
def inpl(): return list(map(int, input().split()))
N,M,X,Y = inpl()
xx = inpl()
yy = inpl()
if max(xx) < min(yy):
  print('No War')
else:
  print('War')

Submission status: Wrong Answer

Solution code:
N, M, X, Y = map(int, input().split())
 
x = list(map(int, input().split()))
y = list(map(int, input().split()))
 
x.sort()
x.reverse()
y.sort()
 
if (y[0] - x[0]) > 0:
    for i in range(x[0]+1, y[0]+1):
        if (X < i) and (i <= Y) and (x[0] < i) and (y[0] >= i):
            print("No War")
            break
else:
    print("War")

Submission status: Wrong Answer

Solution code:
l = input().split()


N = int(l[0])
M = int(l[1])
X = int(l[2])
Y = int(l[3])

"""
if X < -100:
    X = -100
elif X > 100:
    X = 100

if Y < -100:
    Y = -100
elif Y > 100:
    Y = 100
"""

lx = input().split()
ly = input().split()

lx = [int(z) for z in lx]
ly = [int(z) for z in ly]

lx = sorted(lx)


ly = sorted(ly)

flag = True


if int(ly[0]) - int(lx[N-1]) >= 1:
    for z in range(int(lx[N-1]) + 1, int(ly[0]) + 1):

        if z > X and z <= Y:
            flag = False
            break

else:
    flag = False

if flag:
    print("War")
else:
    print("No War")

Submission status: Wrong Answer

Solution code:
S = [int(i) for i in input().split()]
N = S[0]
M = S[1]
X = S[2]
Y = S[3]
C = [int(i) for i in range(N)]
D = [int(i) for i in range(M)]
 
x = max(C)
y = min(D)
 
if x < y:
    A = 1
elif x >= y:
    A = 0

if A == 1:
    if X > x and y > X:
        B = 1
    elif Y < y and x <= Y:
        B = 1
    elif x < X and y >= Y:
        B = 1
    elif X < x < Y and X < y <= Y:
        B = 1

if A == 1 and B == 1:
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

Solution code:
S = [int(i) for i in input().split()]
N = S[0]
M = S[1]
X = S[2]
Y = S[3]
C = [int(i) for i in range(N)]
D = [int(i) for i in range(M)]
 
x = max(C)
y = min(D)
 
if x < y:
    A = 1
elif x >= y:
    A = 0

if A == 1:
    if X > x and y > X:
        B = 1
    if Y < y and x <= Y:
        B = 1
    if x < X and y >= Y:
        B = 1
    if X < x < Y and X < y <= Y:
        B = 1

if A == 1 and B == 1:
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

Solution code:
S = [int(i) for i in input().split()]
N = S[0]
M = S[1]
X = S[2]
Y = S[3]
C = [int(i) for i in range(N)]
D = [int(i) for i in range(M)]
 
x = max(C)
y = min(D)
 
if x < y:
    A = 1
elif x >= y:
    A = 0

if A == 1:
    if X > x:
        if y > X:
            B = 1
    if Y < y:
        if x <= Y:
            B = 1
    if x < X and y > Y:
        B = 1
    if X < x < Y and X < y <= Y:
        B = 1
        
if A == 1 and B == 1:
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

Solution code:
S = [int(i) for i in input().split()]
N = S[0]
M = S[1]
X = S[2]
Y = S[3]
C = [int(i) for i in range(N)]
D = [int(i) for i in range(M)]
 
x = max(C)
y = min(D)
 
if x < y:
    A = 1
elif x >= y:
    A = 0

if A == 1:
    if X > x:
        if Y >= y:
            B = 1
    if Y < y:
        if X < x:
            B = 1
    if x < X and y > Y:
        B = 1
    if X < x < Y and X < y <= Y:
        B = 1
if A == 1 and B == 1:
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

Solution code:
l = input().split()


N = int(l[0])
M = int(l[1])
X = int(l[2])
Y = int(l[3])

"""
if X < -100:
    X = -100
elif X > 100:
    X = 100

if Y < -100:
    Y = -100
elif Y > 100:
    Y = 100
"""

lx = input().split()
ly = input().split()

lx = [int(z) for z in lx]
ly = [int(z) for z in ly]

lx = sorted(lx)


ly = sorted(ly)

flag = True



if int(ly[0]) - int(lx[N-1]) >= 1:
    for z in range(int(lx[N-1]) + 1, int(ly[0]) + 1):

        if z <= X and z > Y:
            flag = True
            break

        flag = False

else:
    flag = False

if flag:
    print("No war")
else:
    print("War")

Submission status: Wrong Answer

Solution code:
import numpy as np
N, M, X, Y = input().split() 
x = input().split()
y = input().split()
x = np.array(x, int)
y = np.array(y, int)

if X < Y and np.max(x) < np.min(y):
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

Solution code:
a, b, c, d = map(int, input().split())
if 10>a>4:
    print("War")
elif c>10:
    print("No War")
elif d>10:
    print("War")
elif b>0:
    print("No War")
else:
    print("No War")

Submission status: Wrong Answer

Solution code:
a, b, c, d = map(int, input().split())
if 10>a>3:
    print("War")
elif c>10:
    print("No War")
elif d>10:
    print("War")
elif b>0:
    print("No War")
else:
    print("No War")

Submission status: Wrong Answer

Solution code:
S = [int(i) for i in input().split()]
N = S[0]
M = S[1]
X = S[2]
Y = S[3]
C = [int(i) for i in range(N)]
D = [int(i) for i in range(M)]
 
x = max(C)
y = min(D)
 
if x < y:
    A = 1
elif x >= y:
    A = 0

if A == 1:
    if X > x:
        if Y >= y:
            B = 1
    if Y < y:
        if X < x:
            B = 1
    if x < X and y > Y:
        B = 1
 
if A == 1 and B == 1:
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

Solution code:
a, b, c, d = map(int, input().split())
if a>0:
    print("War")
elif c>10:
    print("War")
elif d>10:
    print("War")
elif b>0:
    print("No War")
else:
    print("No War")

Submission status: Wrong Answer

Solution code:
a, b, c, d = map(int, input().split())
if a>0:
    print("War")
elif c>10:
    print("War")
elif d>10:
    print("War")
elif b>0:
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

Solution code:
n, m, x, y =  map(int, input().split())
p = sorted(list(map(int, input().split())), reverse=True)
q = sorted(list(map(int, input().split())))
if max(x, p[0]) < min(q[0], y):
  print("No war")
else:
  print("War")

Submission status: Wrong Answer

Solution code:
a, b, c, d = map(int, input().split())
if a>0:
    print("War")
elif c>10:
    print("War")
elif b>0:
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

Solution code:

array = list(map(int, input().split()))
#array.sort(reverse = True)
N = array[0]
M = array[1]
X = array[2]
Y = array[3]

xarray = list(map(int, input().split()))
xarray.sort(reverse = True)
##print(xarray)
xmax = xarray[0]

yarray = list(map(int, input().split()))
yarray.sort()
##print(yarray)
ymin = yarray[0]
if (ymin > xmax):
    print("No War")
else:
    print("War")

##print(array)

Submission status: Wrong Answer

Solution code:
a, b, c, d = map(int, input().split())
if a>0:
    print("War")
elif b>0:
    print("No War")
elif c>10:
    print("War")
else:
    print("War")

Submission status: Wrong Answer

Solution code:
S = [int(i) for i in input().split()]
N = S[0]
M = S[1]
X = S[2]
Y = S[3]
C = [int(i) for i in range(N)]
D = [int(i) for i in range(M)]
 
x = max(C)
y = min(D)
 
if x < y:
    A = 1
elif x >= y:
    A = 0
 
if X > x:
    if Y >= y > X:
        B = 1
if Y < y:
    if X < x < Y:
        B = 1
if X < (x + y) / 2 <= Y:
    B = 1
if x < X and y > Y:
    B = 1
 
if A == 1 and B == 1:
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

Solution code:
a, b, c, d = map(int, input().split())
if a>0:
    print("War")
elif b>0:
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

Solution code:
array = list(map(int, input().split()))
#array.sort(reverse = True)
N = array[0]
M = array[1]
X = array[2]
Y = array[3]

xarray = list(map(int, input().split()))
xarray.sort(reverse = True)
##print(xarray)
xmax = xarray[0]

yarray = list(map(int, input().split()))
yarray.sort()
##print(yarray)
ymin = yarray[0]
if (ymin > xmax):
    if(abs(ymin - xmax) >= 1):
        if(abs(X-Y) >= 1):
            print("No war")
        else:
            print("War")
    else:
        print("War")
else:
    print("War")

Submission status: Wrong Answer

Solution code:
a, b, c, d = map(int, input().split())
if a>0:
    print("No War")
elif b>0:
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

Solution code:
S = [int(i) for i in input().split()]
N = S[0]
M = S[1]
X = S[2]
Y = S[3]
C = [int(i) for i in range(N)]
D = [int(i) for i in range(M)]

x = max(C)
y = min(D)

if x < y:
    A = 1
elif x >= y:
    A = 0

if X < x:
    if Y >= y > X:
        B = 1
if Y < y:
    if X < x <= Y:
        B = 1
if X < (x + y) / 2 <= Y:
    B = 1
if x < X and y > Y:
    B = 1

if A == 1 and B == 1:
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

Solution code:
N,M,X,Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

if X>Y:
    print("War")
elif max(x)<min(y):
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

Solution code:
n, m, x, y =  map(int, input().split())
p = sorted(list(map(int, input().split())), reverse=True)
q = sorted(list(map(int, input().split())))
if x < q[0] <= y and p[0] < q[0]:
  print("No war")
else:
  print("War")

Submission status: Wrong Answer

Solution code:
N,M,X,Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

if X>Y:
    print("War")
elif max(x)<=min(y):
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

Solution code:
S = [int(i) for i in input().split()]
N = S[0]
M = S[1]
X = S[2]
Y = S[3]
C = [int(i) for i in range(N)]
D = [int(i) for i in range(M)]
 
x = max(C)
y = min(D)
 
if x < y:
    A = 1
elif x >= y:
    A = 0
 
if X > x:
    if Y >= y > X:
        B = 1
if Y < y:
    if X < x < Y:
        B = 1
if X < (x + y) / 2 <= Y:
    B = 1
 
if A == 1 and B == 1:
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

Solution code:
from functools import reduce

N, M, X, Y = tuple(map(int, input().split()))
want_X = set(map(int, input().split()))
want_Y = set(map(int, input().split()))

line_X = reduce(lambda acc, x: x if abs(Y - x) < abs(Y - acc) else acc,
    want_X, X)
line_Y = reduce(lambda acc, y: y if abs(X - y) < abs(X - acc) else acc,
    want_Y, Y)

print('No War' if X < Y and line_X < line_Y else 'War')

Submission status: Wrong Answer

Solution code:
n, m, x, y =  map(int, input().split())
p = sorted(list(map(int, input().split())), reverse=True)
q = sorted(list(map(int, input().split())))
if x < q[0] <= y and p[0] < y and p[0] < q[0]:
  print("No war")
else:
  print("War")

Submission status: Wrong Answer

Solution code:
# 整数の入力
N, M, X, Y = map(int, input().split())
x = map(int, input().split())
y = map(int, input().split())

x_max = max(x)
y_min = min(y)

flag_war = True

for z in range(X+1, Y+1):
    print(z)
    if x_max < z:
        if y_min >= z:
            print('No War')
            flag_war = False
            break
        else:
            continue
    else:
        continue
if flag_war == True:
    print('War')

Submission status: Wrong Answer

Solution code:
N, M, X, Y= map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))


xx = max(x)
yy = min(y)

if (X >= Y):
    print('War')
elif (xx >= yy):
    print('War')
elif (yy <= X):
    print('War')
elif (Y <= xx):
    print('War')
else:
    print('No war')

Submission status: Wrong Answer

Solution code:

array = list(map(int, input().split()))
#array.sort(reverse = True)
N = array[0]
M = array[1]
X = array[2]
Y = array[3]

xarray = list(map(int, input().split()))
xarray.sort(reverse = True)
##print(xarray)
xmax = xarray[0]

yarray = list(map(int, input().split()))
yarray.sort()
##print(yarray)
ymin = yarray[0]
if (ymin > xmax):
    if(abs(ymin - xmax) >= 3):
        print("No War")
    else:
        print("War")
else:
    print("War")

##print(array)

Submission status: Wrong Answer

Solution code:
N, M, X, Y = map(int, input().split())

xlist = list(map(int, input().split()))
ylist = list(map(int, input().split()))



xlist.sort()
ylist.sort()

xmax=xlist[N-1]
ymax=ylist[M-1]
xmin=xlist[0]
ymin=ylist[0]



if X+1<=Y and xmax<ymin and xmax<=Y and ymin>X:
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

Solution code:
S = [int(i) for i in input().split()]
N = S[0]
M = S[1]
X = S[2]
Y = S[3]
C = [int(i) for i in range(N)]
D = [int(i) for i in range(M)]

x = max(C)
y = min(D)

if x < y:
    A = 1
elif x >= y:
    A = 0

if X < x:
  if Y >= y > X:
    B = 1
if Y < y:
  if X < x <= Y:
    B = 1
if X < (x + y) / 2 <= Y:
    B = 1

if A == 1 and B == 1:
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

Solution code:
N, M, X, Y= map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))


xx = max(x)
yy = min(y)

if (X > Y):
    print('War')
elif (xx > yy):
    print('War')
elif (yy < X):
    print('War')
elif (Y < xx):
    print('War')
else:
    print('No war')

Submission status: Wrong Answer

Solution code:
n, m, x, y = map(int,input().split())
lsx = input().split()
lsy = input().split()
lsx = list(map(int, lsx))
lsy = list(map(int, lsy))
z = 0

lsxmax = max(lsx)
lsymin = min(lsy)
for i in range(x + 1, y + 1):
	if ((i > lsxmax) and (i <= lsymin)):
		z = i
if(z):
	print("No War")
else:
	print("War")

Submission status: Wrong Answer

Solution code:
n,m,X,Y = map(int, input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
print(X<Y)
print(min(y)-max(x)>0)
print((Y>max(x) or X<min(y)))
if X<Y and (min(y)-max(x)>0) and (Y>max(x) and X<min(y)):
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

Solution code:

array = list(map(int, input().split()))
#array.sort(reverse = True)
N = array[0]
M = array[1]
X = array[2]
Y = array[3]

xarray = list(map(int, input().split()))
xarray.sort(reverse = True)
##print(xarray)
xmax = xarray[0]

yarray = list(map(int, input().split()))
yarray.sort()
##print(yarray)
ymin = yarray[0]
if (ymin > xmax):
    if(abs(ymin - xmax) >= 1):
        print("No War")
    else:
        print("War")
else:
    print("War")

##print(array)

Submission status: Wrong Answer

Solution code:
str1 = input();
str2 = str1.split(" ")
n = int(str2[0])
m = int(str2[1])
xcap = int(str2[2])
ycap = int(str2[3])

strx = input()
stry = input()
strx2 = strx.split(" ")
stry2 = stry.split(" ")
for i in range(n):
    strx2[i] = int(strx2[i])

for i in range(m):
    stry2[i] = int(stry2[i])

if max(strx2) < min(stry2):
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

Solution code:
l = input().split()


N = int(l[0])
M = int(l[1])
X = int(l[2])
Y = int(l[3])

if X < -100:
    X = -100
elif X > 100:
    X = 100

if Y < -100:
    Y = -100
elif Y > 100:
    Y = 100


lx = input().split()
ly = input().split()

lx = [int(z) for z in lx]
ly = [int(z) for z in ly]

lx = sorted(lx)


ly = sorted(ly)

flag = True

if Y > X:
    flag = False


if int(ly[0]) - int(lx[N-1]) >= 1:
    for z in range(int(lx[N-1]) + 1, int(ly[0]) + 1):
        if z <= X or z > Y:
            flag = False
            break

else:
    flag = False

if flag:
    print("No war")
else:
    print("War")

Submission status: Wrong Answer

Solution code:
array = list(map(int, input().split()))
#array.sort(reverse = True)
N = array[0]
M = array[1]
X = array[2]
Y = array[3]

xarray = list(map(int, input().split()))
xarray.sort(reverse = True)
##print(xarray)
xmax = xarray[0]

yarray = list(map(int, input().split()))
yarray.sort()
##print(yarray)
ymin = yarray[0]
if (ymin > xmax):
    if(abs(ymin - xmax) >= 2):
        print("No War")
    else:
        print("War")
else:
    print("War")

##print(array)

Submission status: Wrong Answer

Solution code:
N,M,X,Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

if X>=Y:
    print("War")
elif max(x)>max(y):
    print("War")
else:
    print("No War")

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python

N, M, X, Y = map(int, input().split())
X_arr = map(int, input().split())
Y_arr = map(int, input().split())

if not(X < Y):
    print("War")
else:
    if (max(X_arr) < min(Y_arr)):
        print("No War")
    else:
        print("War")

Submission status: Wrong Answer

Solution code:
M, N, X, Y = map(int, input().split())

xs = list(map(int,input().split()))
ys = list(map(int,input().split()))

#print(M,N,X,Y)
#pArint(xs,ys)
result = "No War"
xy = []

for n in range(X+1,Y):
    xy.append(n)

if len(xy) == 0:
    result = "War"

xMax = max(xs)
yMin = min(ys)

for n in xy:
    if xMax >= n or n > yMin:
        result = "War"

print(result)

Submission status: Wrong Answer

Solution code:
S = [int(i) for i in input().split()]
N = S[0]
M = S[1]
X = S[2]
Y = S[3]
C = [int(i) for i in range(N)]
D = [int(i) for i in range(M)]

x = max(C)
y = min(D)

if x < y:
    A = 1
elif x >= y:
    A = 0

if X < (x + y) / 2 <= Y:
    B = 1
else:
    B = 0

if A == 1 and B == 1:
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
N,M,X,Y=[int(i) for i in input().split()]
x=[int(i) for i in input().split()]
y=[int(i) for i in input().split()]

x.sort()
y.sort()

#print(x,y)

if x[-1] < y[0]:
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

Solution code:
zahyo = input().split()
ateikoku = input().split()
bteikoku = input().split()
if int(max([int(max(ateikoku)),int(zahyo[2])]) - min([int(min(bteikoku)),int(zahyo[3])])) > 0:
    print("War")
else:
    print("No War")

Submission status: Wrong Answer

Solution code:
M, N, X, Y = map(int, input().split())

xs = list(map(int,input().split()))
ys = list(map(int,input().split()))

#print(M,N,X,Y)
#pArint(xs,ys)
result = "No War"
xy = []

for n in range(X+1,Y):
    xy.append(n)
print(xy)

if len(xy) == 0:
    result = "War"

xMax = max(xs)
yMin = min(ys)

for n in xy:
    if xMax >= n or n > yMin:
        result = "War"

print(result)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
N,M,X,Y=[int(i) for i in input().split()]
x=[int(i) for i in input().split()]
y=[int(i) for i in input().split()]

x.sort()
y.sort()

#print(x,y)

if x[-1] <= y[0]:
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

Solution code:
def return_border_Z(X_zone, Y_zone, X_empire):
    X_max = max(X_want_controls)
    Y_min = min(Y_want_controls)
    if X_max > Y_min:
        return None
    # X_max <= Y_min の場合
    if X_empire < X_max:
        return X_max + 1
        # X_empire < Z, かつ x1, ..., xN < Zを満たす
    else: # X_empire >= X_max (X_empireとY_minの大小が問題)
        return min(X_empire+1, Y_min)
        # X_empire+1が返るとき、X_empire < Z, かつ x1, ..., xN < Zを満たす
        # Y_minが返るとき、Y_min(=Z) <= X_empire なので、Zは制約違反

line1 = input()
X_count, Y_count, X_empire, Y_empire = map(int, line1.split()) # TODO: 値を捨てるアンパッキングの書き方
line2 = input()
X_want_controls = list(map(int, line2.split()))
line3 = input()
Y_want_controls = list(map(int, line3.split()))

Z = return_border_Z(X_want_controls, Y_want_controls, X_empire)
# print(Z)
if Z is None:
    print('War')
# 以降Zはint
elif X_empire < Z and Z <= Y_empire:
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

Solution code:
N,M,X,Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

if X>=Y:
    print("War")
elif max(x)>=max(y):
    print("War")
else:
    print("No War")