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 = map(int, input().split())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
x_max = max(xs)
y_min = min(ys)
def get_war(x_max, y_min, X, Y):
    if y_min > x_max:
        for z in list(range(x_max, y_min + 1)):
            if (z > X) and (z <= Y):
                return 'No War'
            else:
                pass
        else:
            return 'War'
    else:
        return 'War'
print(get_war(x_max, y_min, X, Y))

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()
y.sort()
War = False

xmax = x[-1]
ymin = y[0]


if xmax > ymin:
    War = True

if X>Y:
    War = True

if X in y or Y in x:
    War = True
    
if War == True:
    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()))
flag=0
for i in range(N):
  if x[i]==Y:
    flag+=1
for i in range(M):
  if y[i]==X:
    flag+=1
if flag>0:
  print("War")
else:
  if min(y)>max(x):
    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()))

if X < Y:
    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('War' if line_Y < line_X or abs(line_Y - line_X) < 1 else 'No War')
else:
    print('War')

Submission status: Wrong Answer

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


min_range = max(list_x)
max_range = min(list_y)

ans = 0

for i in range(X+1, Y):
  if(i > min_range and i <= max_range):
    ans = 1

if (ans == 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( )))

x.sort()
y.sort()
War = False

xmax = x[-1]
ymin = y[0]

print(xmax,ymin)

if xmax > ymin:
    War = True

if X>Y:
    War = True

if X in y or Y in x:
    War = True
    
if War == True:
    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()))
_x.sort()
_y.sort()

if max(_x) >= min(_y):
	print("War")
elif X > min(_y):
	print("War")
elif max(_x) >= Y:
	print("War")
else:
	print("No 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()))

a=max(x)+1
b=min(y)

def judge(a,b):
    if(a<=b):
        return print("No War")
    else:
        z=range(a,b+1)
        for i in z:
            if(i>X and i<=Y):
                return print("No War")
        else:
            return print("War")
        
judge(a,b)

Submission status: Wrong Answer

Solution code:
n,m,x,y = map(int, input().split())
px = list(map(int, input().split()))
py = list(map(int, input().split()))
if sum([r in range(max(px)+1, min(py)) for r in range(x+1,y+1)]) != 0:
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

Solution code:
n,m,x,y = map(int,input().split())
xarr = list(map(int,input().split()))
yarr = list(map(int,input().split()))

xarr.sort(reverse=True)
yarr.sort()

if x+1 >= y or xarr[0] >= yarr[0] or xarr[0] >= y or yarr[0] <= x:
    print('war')
else:
    print('no war')

Submission status: Wrong Answer

Solution code:
N,M,X,Y= map(int, raw_input().split())
xlist= map(int, raw_input().split())
ylist= map(int, raw_input().split())
xlist.sort()
ylist.sort()
if xlist[-1]<=ylist[0] and xlist[-1]<=Y and ylist[0]>X:
    print "No War"
else:
    print "War"

Submission status: Wrong Answer

Solution code:
n, m, X, Y =(int(x) for x in input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
z = []
z = range(X+1,Y+1)
if min(z) > max(x) and max(z) <= min(y):
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

Solution code:
n, m, x, y = [int(i) for i in input().split(" ")]
x_range = [int(i) for i in input().split(" ")]
y_range = [int(i) for i in input().split(" ")]
war = True
for z in range(x, y):
    if x < z <= y and max(x_range) < z <= max(y_range):
        war = False
print("War" if war else "No 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])
xcon=[]
ycon= []

xcon = input().split(" ")
for i in range(n):
    xcon[i] = int(xcon[i])

ycon = input().split(" ")
for i in range(m):
    ycon[i]=int(ycon[i])

xcon = sorted(xcon)
ycon = sorted(ycon)

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

Submission status: Wrong Answer

Solution code:
n,m,x,y=map(int ,input().split())
a=list(map(int ,input().split()))
b=list(map(int ,input().split()))
l=a[0]
r=b[0]
for i in a:
    if i > x:
        if i<l:
            pass
        else:
            l=i
            if l>r:
                print('War')
                exit()
    if i>y:
        print('War')
        exit()
           
for i in b:
    if i <y:
        if i>r:
            pass
        else:
            r=i
            if l>r:
                print('War')
                exit()
    if i<=x:
        print('War')
        exit() 
if l==r:
    if r==y:
        print('No War')
    else:
        print('War')
else:
    print('No War')

Submission status: Wrong Answer

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

    mx = max(x)
    my = min(y)

    lx = max(mx, X)
    ly = min(my, Y)
    if lx < ly:
        print("No war")
    else:
        print("War")

Submission status: Wrong Answer

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

data_x = list(map(int,input().split()))
data_y = list(map(int,input().split()))

max_x = max(data_x)
min_y = min(data_y)

if  max_x > min_y:
	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(' '))) + [X]
y = list(map(int, input().split(' '))) + [Y]

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

Submission status: Wrong Answer

Solution code:
n,m,x,y = map(int, input().split())
px = list(map(int, input().split()))
py = list(map(int, input().split()))
if sum([r in range(max(px), min(py)+1) for r in range(x+1,y+1)]) != 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 x < q[0] 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=list(map(int,input().split()))
y=list(map(int,input().split()))
if min(y)>max(x):
  print("No War")
else:
  print("War")

Submission status: Wrong Answer

Solution code:
head=[int(n) for n in input().split()]
list_x=[int(n) for n in input().split()]
list_y=[int(n) for n in input().split()]
if max(list_x) < min(list_y):
    print("War")
else:
    print("No War")

Submission status: Wrong Answer

Solution code:
n,m,x,y = map(int, input().split())
px = list(map(int, input().split()))
py = list(map(int, input().split()))
if sum([r in range(max(px), min(py)) for r in range(x+1,y+1)]) != 0:
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

Solution code:
n, m, X, Y = map(int, input().split())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
x_max = max(xs)
y_min = min(ys)
if y_min > x_max:
    for z in list(range(x_max, y_min + 1)):
        if (z > X) and (z <= Y):
            print('No War')
            break
    else:
        print('War')
else:
    print('No War')

Submission status: Wrong Answer

Solution code:
n,m,x,y = map(int,input().split())
xi = list(map(int,input().split()))
yi = list(map(int,input().split()))
x_max = max(xi)
x_min = min(xi)
y_max = max(xi)
y_min = min(yi)
a = 0
if x_max < y_min:
    if x < y_min and y > x_max:
        a += 1
elif x_min > y_max:
    if x > y_max and y < x_min:
        a += 1
if a >= 1:
    print("No War")
else:
    print("war")

Submission status: Wrong Answer

Solution code:
n, m, X, Y = map(int,input().split())
x = [int(x) for x in input().split()]
y = [int(x) for x in input().split()]
if X>= Y:
  print('War')
else:
  xmax = max(x)
  ymin = min(y)
  if ymin<0:
    if xmax < int(ymin)-1:
      print('No War')
    else:
      print('War')
  else:
    if xmax<int(ymin):
      print('No War')
    else:
      print('War')

Submission status: Wrong Answer

Solution code:
n,m,x,y = map(int, input().split())
px = list(map(int, input().split()))
py = list(map(int, input().split()))
if sum([r in range(max(px), min(py)) for r in range(x+1,y+1)]):
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

Solution code:
n, m, X, Y = map(int, input().split())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
x_max = max(xs)
y_min = min(ys)
if y_min >= x_max:
    for z in list(range(x_max, y_min + 1)):
        if (z > X) and (z <= Y):
            print('No War')
            break
    else:
        print('War')
else:
    print('War')

Submission status: Wrong Answer

Solution code:
f=input().split()
(n,m,x,y)=(int(f[0]),int(f[1]),int(f[2]),int(f[3]))
ax=[int(i) for i in input().split()]
ay=[int(i) for i in input().split()]
ax.sort()
ay.sort()
b=ay[0]-ax[-1]
if 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()))

ans = "War"
for z in range(-100,100):
    if X >= z and z > Y:
        break
    for i in range(N):
        if x[i] >= z:
            break
    for i in range(M):
        if y[i] < z:
            break
else:
    ans = "No War"

print(ans)

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])
xcon=[]
ycon= []
if x > y:
    print("War")
else:
    xcon = input().split(" ")
    for i in range(n):
        xcon[i] = int(xcon[i])
    ycon = input().split(" ")
    for i in range(m):
        ycon[i]=int(ycon[i])
    xcon = sorted(xcon)
    ycon = sorted(ycon)
    if x <= xcon[-1] <ycon[0] <=  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( )))
z=list(range(X+1,Y+1))
def x_f(x):
    if x<Z:
        return x
def y_f(y):
    if y>=Z:
        return y
ans='War'
for Z in z:
    x_a=list(filter(x_f, x))
    y_a=list(filter(y_f, y))
    if len(x_a)==n and len(y_a)==m:
        ans='No War'
print(ans)

Submission status: Wrong Answer

Solution code:
xy=input().split()
X=xy[2]
Y=xy[3]
n=input().split()
n.append(X)
n=[int(i) for i in n]
n=sorted(n)
m=input().split()
m.append(Y)
m=[int(i) for i in m]
m=sorted(m)
x=n[-1]
y=m[0]
if x>y:
    print("War")
else:
    print("No War")

Submission status: Wrong Answer

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

    mx = max(x)
    my = min(y)

    if mx >= my:
        print("War")
    else:
        m_list = [i for i in range(mx+1, my+1)]
        cap = [i for i in range(X+1, Y+1)]
        if len(set(m_list) & set(cap)) >= 1:
            print("No war")
        else:
            print("War")

Submission status: Wrong Answer

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

if max(Xl) < min(Yl) and (max(Xl) < Y or min(Yl) > X):
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

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


min_range = max(list_x)
max_range = min(list_y)

ans = 0

for i in range(X+1, Y):
  if(i > min_range and i <= max_range):
    ans = 1

if (ans == 1):
  print("No war")
elif (ans == 0):
  print("War")

Submission status: Wrong Answer

Solution code:
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()
z = X + 1
max_x = x[-1]
min_y = y[0]
while z<Y:
    if(max_x < z and min_y >=z):
        print('No War')
        print(z)
        break
    else:
        z = z + 1
if (z>=Y):
    print('War')

Submission status: Wrong Answer

Solution code:
n,m,x,y=map(int ,input().split())
a=list(map(int ,input().split()))
b=list(map(int ,input().split()))
l=a[0]
r=b[0]
for i in a:
    if i > x:
        if i<l:
            pass
        else:
            l=i
            if l>r:
                print('War')
                exit()
    if i>=y:
        print('War')
        exit()
           
for i in b:
    if i <y:
        if i>r:
            pass
        else:
            r=i
            if l>r:
                print('War')
                exit()
    if i<=x:
        print('War')
        exit() 
     
print('No War')

Submission status: Wrong Answer

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

for i in range(len(xList)):
  xList[i] = int(xList[i])
for j in range(len(yList)):
  yList[j] = int(yList[j])

xList.sort()
yList.sort()

if yList[0] - 1 > xList[len(xList) - 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( )))
z=list(range(X+1,Y+1))
def x_f(x):
    if x<Z:
        return x
def y_f(y):
    if y>=Z:
        return y
ans='War'
for Z in z:
    x_a=list(filter(x_f, x))
    y_a=list(filter(y_f, y))
    if len(x_a)==X and len(y_a)==Y:
        ans='No War'
print(ans)

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( min(y) - max(x) > 0 and  Y >= min(y) > X and X < max(x) < Y):
    print("No war")
else:
    print("War")

Submission status: Wrong Answer

Solution code:
a=input()
b=input()
c=input()

a=[int(x) for x in a.split(" ")]
b=[int(x) for x in b.split(" ")]
c=[int(x) for x in c.split(" ")]

b.sort(reverse=True)
c.sort()

for x in range(a[2]+1,a[3]+2):
    if b[0] < x and c[0] >= x:
        print("No War")
        break
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()))

mx = max(x)
my = min(y)

if my - mx > 1:
    mxx = mx
    for i in range(my - mx - 1):
        mxx += 1
        if X < mxx and mxx <= Y and my >= mxx:
            print("No War")
            exit()
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(' ')))

Z = min(min(y), Y)
if X < Z and max(x) < Z:
    print('No war')
else:
    print('War')

Submission status: Wrong Answer

Solution code:
N, M, X, Y = [int(i) for i in input().split()]
x_list  = [int(i) for i in input().split()]
y_list  = [int(i) for i in input().split()]

x_max = max(x_list)
y_min = min(y_list)

z_list = range(X+1, Y+1)

war = 1

if x_max >= y_min:
    pass
else:
    for i in range(x_max, y_min):
        if i in z_list:
            war = 0
            break

if war == 0:
    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()))
mx=max(x)
my=min(y)
r=my-mx
mes='War'
if r>=1:
    for i in range(1,r+1):
        if X<mx+i and mx+i<=my:
            mes=('No War')
            break
print(mes)

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()
_y.sort()

if max(_x) >= min(_y):
	print("War")
elif X >= min(_y):
	print("War")
elif max(_x) > Y:
	print("War")
else:
	print("No War")

Submission status: Wrong Answer

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

    xs = sorted(xs)
    ys = sorted(ys)

    print(xs)
    print(ys)

    count = ys[0] - xs[-1]
    
    for i in range(count):
        Z = xs[-1] + i + 1
        print(Z)
        if X < Z and Z <= Y:
            return False

    return True


if __name__ == '__main__':
    if main():
        print("War")
    else:
        print("No War")

Submission status: Wrong Answer

Solution code:
n = input().split()
x = input().split()
y = input().split()

start = int(n[2]) + 1
end = int(n[3]) + 1
for i in range(start, end):
    check = 0
    for x_c in x:
        if i < int(x_c):
            check = 1
            break
    for y_c in y:
        if i > int(y_c):
            check = 1
            break 
    if check == 0:
        print("No War")
        exit()
print("War")

Submission status: Wrong Answer

Solution code:
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()
for i in range(X+1,Y+1):
    if i < x[-1] and i <= y[0]:
        print("No War")
        break
    print("War")

Submission status: Wrong Answer

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

for i in range(len(xList)):
  xList[i] = int(xList[i])
for j in range(len(yList)):
  yList[j] = int(yList[j])

xList.sort()
yList.sort()

if yList[0] - 1 >= xList[len(xList) - 1]:
  index = yList[0] - 1
  while index > xList[len(xList) - 1]:
    if X < index and index <= Y:
      print("No War")
      break
    else:
      index -= 1
    
  print("War")
else:
  print("War")

Submission status: Wrong Answer

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

x_n = []
for part in input().split():
    x_n.append(int(part))

y_n = []
for part in input().split():
    y_n.append(int(part))

x_n.sort()
x_n.reverse()
y_n.sort()

if x_n[0] < y_n[0] and x < y_n[0]:
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

Solution code:

NMXY =  list(int(i) for i in input().split())
x =  list(int(i) for i in input().split())
y =  list(int(i) for i in input().split())


x.append(NMXY[2])

y.append(NMXY[3])
print(max(x))
print(min(y))
if 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 min(y) > max(x) and X < Y:
    print('No war')
else:
    print('War')

Submission status: Wrong Answer

Solution code:
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()
z = X + 1
while z<Y:
    if(x[-1] < z and y[0] > z):
        print('No War')
        print(z)
        break
    else:
        z = z + 1
if (z>=Y):
    print('War')

Submission status: Wrong Answer

Solution code:
def main():
    s = [int(item) for item in input().split()]
    _, _, X, Y = s
    xs = [int(item) for item in input().split()]
    ys = [int(item) for item in input().split()]
    mx = max(xs)
    my = min(ys)
    if mx >= Y:
        print('War')
        return
    if my < X:
        print('War')
        return
    if mx >= my:
        print('War')
        return
    print('No War')


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
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()
for i in range(X+1,Y+1):
    if i < x[-1] and i <= y[0]:
        print("No War")
        break
print("War")

Submission status: Wrong Answer

Solution code:
n,m,cx,cy = map(int,input().split())
x = list(int(i) for i in input().split())
y = list(int(i) for i in input().split())

x.sort()
y.sort()
z = range(cx+1,cy+1)

ans = "War"
for v in z:
    if (v > x[n-1]) and (v <= y[0]):
        ans = "No war"
        break

print(ans)

Submission status: Wrong Answer

Solution code:
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()
z = X + 1
while z<Y:
    if(x[-1] < z and y[0] > z):
        print('No War')
        print(z)
        break
    else:
        z = z + 1
if (z>Y):
    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 max(x) < min(y) and X != min(y):
  print('No War')
else:
  print('War')

Submission status: Wrong Answer

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

    xs = sorted(xs)
    ys = sorted(ys)

    print(xs)
    print(ys)

    count = ys[0] - xs[-1]
    
    for i in range(count):
        Z = xs[-1] + i + 1
        if X < Z and Z <= Y:
            return False

    return True


if __name__ == '__main__':
    if main():
        print("War")
    else:
        print("No War")

Submission status: Wrong Answer

Solution code:
n, m, x, y = map(int,input().split())
xs = map(int,input().split())
ys = map(int,input().split())
xs = sorted(xs)
ys = sorted(ys)

if xs[-1] <= ys[0] and xs[-1] <= y and x < ys[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()))

mx = max(x)
my = min(y)

if my - mx > 1:
    lis = []
    for i in range(my - mx - 1):
        mx += 1
        if X < mx and mx <= Y:
            print("No War")
            exit()

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=sorted(map(int, input().split()))
Zx=max(map(int, input().split()))
Zy=min(map(int, input().split()))
if X < Zy and Zy <= Y and Zx < Zy:
  print('No War')
else:
  print('War')

Submission status: Wrong Answer

Solution code:
n,m,x,y=map(int,input().split())
lis_x = list(map(int,input().split()))
lis_y = list(map(int,input().split()))
lis_x.sort()
lis_y.sort()
rest = []
for i in range(100):
    if i >= lis_x[-1] and i <= lis_y[0]:
        rest.append(i)
for i in range(len(rest)):
    if x < rest[i] and rest[i] <= y:
        print('No War')
        exit()
print('War')

Submission status: Wrong Answer

Solution code:
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()
z = X + 1
while z<Y:
    if(x[-1] < z and y[-1] > z):
        print('No War')
        break
    else:
        z = z + 1
if (z>Y):
    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( min(y) - max(x) > 0 or min(y) < X or max(x) > Y):
    print("No war")
else:
    print("War")

Submission status: Wrong Answer

Solution code:
n,m,x,y = map(int,input().split())
xlis = list(map(int,input().split()))
ylis = list(map(int,input().split()))

if max(xlis)+1 < min(ylis) and x+1 < min(ylis) and max(xlis)+1 < y:
    print('No War')
    exit()
print('War')

Submission status: Wrong Answer

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

    xs = sorted(xs)
    ys = sorted(ys)

    count = ys[0] - xs[-1]
    
    for i in range(count):
        Z = xs[-1] + i
        if X < Z and Z <= Y:
            return False

    return True


if __name__ == '__main__':
    if main():
        print("War")
    else:
        print("No War")

Submission status: Wrong Answer

Solution code:
n, m, X, Y = map(int, input().split())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
x_max = max(xs)
y_min = min(ys)
if y_min > x_max:
    for z in list(range(x_max, y_min + 1)):
        if (z > X) and (z <= Y):
            print('No War')
            break
    else:
        print('War')
else:
    print('War')

Submission status: Wrong Answer

Solution code:
N,M,X,Y = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
flag = 0
a = max(A)
b = min(B)
for i in range(X+1,Y) :
    if i >= max(A) and i <= Y and i <= min(B) and i > X :
        flag += 1
if flag >= 1 :
    print("No War")
else :
    print("War")

Submission status: Wrong Answer

Solution code:
N,M,X,Y=map(int,input().split(' '))
x_list=list(map(int,input().split(' ')))
y_list=list(map(int,input().split(' ')))
x_max=max(x_list)
y_min=min(y_list)

if((X+1) < Y and (x_max+1) < y_min):
    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()))
xmax=-101
ymin=101
for i in range(N):
	if x[i]>xmax:
		xmax=x[i]
for i in range(M):
	if y[i]<ymin:
		ymin=y[i]
if ymin-xmax>0:
	if X<ymin:
		print("No War")
	else:
		print("War")
else:
	print("War")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, M, X, Y, x, y):
    mx = max(x)
    my = min(y)

    error_print(mx, my)
    if mx < my and (my > X and mx <= Y):
        return 'No War'
    return 'War'


def main():
    N, M, X, Y = read_int_n()
    x = read_int_n()
    y = read_int_n()
    print(slv(N, M, X, Y, x, y))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n, m, x, y = map(int, input().split())
x_list = [int(data) for data in input().split()]
y_list = [int(data) for data in input().split()]

if x < y and max(x_list) < min(y_list) and max(x_list) < x and min(y_list) > 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()))

max_x = max(x_)

min_y = min(y_)


if max_x < min_y and x < y:
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

Solution code:
n,m,x,y=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=max(a);d=min(b)
if c>d:print('War')
elif c==d:
  if x<c and c<=y:print('No War')
  else:print('War')
else:
  if c>=y or d<=x:print('War')
  else:print('No War')

Submission status: Wrong Answer

Solution code:
n, m, x, y = map(int,input().split())
xs = map(int,input().split())
ys = map(int,input().split())
xs = sorted(xs)
ys = sorted(ys)

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, M, X, Y, x, y):
    mx = max(x)
    my = min(y)

    error_print(mx, my)
    if mx < my and (my >= X and mx < Y):
        return 'No War'
    return 'War'


def main():
    N, M, X, Y = read_int_n()
    x = read_int_n()
    y = read_int_n()
    print(slv(N, M, X, Y, x, y))


if __name__ == '__main__':
    main()