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: Accepted

Solution code:
n,m,x,y=map(int,input().split());a,b=list(map(int,input().split())),list(map(int,input().split()));a.sort();b.sort();print("No War"if max(a[-1],x)<min(y,b[0])else"War")

Submission status: Accepted

Solution code:
#coding: utf-8
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
for z in range(X+1, Y+1):
    xflag, yflag = True, True
    for j in range(len(x)):
        if x[j] >= z:
            xflag = False
            break
    for k in range(len(y)):
        if y[k] < z:
            yflag = False
            break
    if xflag == True and yflag == True:
        print("No War")
        exit()
print("War")

Submission status: Accepted

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

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

maxX = max(xs)
minY = min(ys)

for tmpZ in range(maxX+1, minY+1):
	if x < tmpZ <= y:
		print("No War")
		break
else:
	print("War")

Submission status: Accepted

Solution code:
N,M,X,Y = list(map(int,input().split()))
xM = max([X]+list(map(int,input().split())))
ym = min([Y]+list(map(int,input().split())))
if xM<ym : 
    print("No War")
else:
    print("War")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().split())
zmin=max(map(int,input().split()))
zmax=min(map(int,input().split()))
if max(zmin,x)<min(zmax,y):
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
x.append(X)
y.append(Y)
x.sort()
y.sort()
if x[N] < y[0]:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
a = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
if max(a[2], max(x)) < min(a[3], min(y)):
  print('No War')
else:
  print('War')

Submission status: Accepted

Solution code:
N, M, X, Y = [int(n) for n in input().split()]
XC = [int(n) for n in input().split()]
YC = [int(n) for n in input().split()]

def main():
    max_x = max(XC)
    min_y = min(YC)
    if max_x < min_y and\
       set(range(X, Y)) & set(range(max_x, min_y)):
        print('No War')
    else:
        print('War')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, m, x, y = [int(item) for item in input().split()]

xs = sorted([int(item) for item in input().split()] + [x])
ys = sorted([int(item) for item in input().split()] + [y])

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

Submission status: Accepted

Solution code:
import numpy as np
N, M, X, Y = map(int, input().split())
x_n = np.array([input().split()], dtype=int)
y_n = np.array([input().split()], dtype=int)
count=0
for Z in range(X+1, Y+1):
    if np.all(x_n<Z) & np.all(y_n>=Z):
        count+=1
if count>0:
    print('No War')
else:
    print('War')

Submission status: Accepted

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

x_max = max(list(map(int,input().strip().split())))
y_min = min(list(map(int,input().strip().split())))

for p in range(X + 1,Y + 1):
    if x_max < p and p <= y_min:
        print("No War")
        exit()

print("War")

Submission status: Accepted

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()
Z=[i for i in range(x+1,y+1)]
if X[-1]<Y[0]:
  z=[i for i in range(X[-1]+1,Y[0]+1)]
  if len(set(z)&set(Z))>0:
    print("No War")
  else:
    print("War")
else:
  print("War")

Submission status: Accepted

Solution code:
import sys
from sys import stdin
n,m,x,y = [int(x) for x in stdin.readline().rstrip().split()]
xs = [int(x) for x in stdin.readline().rstrip().split()]
ys = [int(x) for x in stdin.readline().rstrip().split()]
for i in range(-100, 101):
    if x < i <= y and max(xs) < i <= min(ys):
        print('No War')
        sys.exit()
print('War')

Submission status: Accepted

Solution code:
n, m, x, y = map(int, input().split())
x_list = [int(i) for i in input().split()]
y_list = [int(i) for i in input().split()]
x_list.append(x)
y_list.append(y)
max_x = max(x_list)
min_y = min(y_list)
if (min_y - max_x) > 0:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
#110
n, m, x, y = map(int, input().split())
xlist = list(map(int, input().split()))
ylist = list(map(int, input().split()))

xmax = max(max(xlist),x)
ymin = min(min(ylist),y)

if(xmax<ymin):
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
data = [int(s) for s in input().split()]

N = data[0]
M = data[1]
X = data[2]
Y = data[3]

a = [int(i) for i in input().split()]
b = [int(j) for j in input().split()]

am = max(a)

bm = min(b)

x = am

i = 0
f = 0

if am >= bm:
    print("War")
    f = 1

else:
    while x < bm:
        
        if x in range(X,Y):
            
            print("No War")
            f = 1
            break
        x += 1


if f == 0:
    print("War")

Submission status: Accepted

Solution code:
N,M,X,Y = map(int, input().split())
x = [int(i) for i in input().split()]
y = [int(j) for j in input().split()]
a = list(range(X+1,Y+1))
b = list(range(max(x)+1,min(y)+1))
if list (set(a)&set(b))!=[]:
    print('No War')
else :
    print('War')

Submission status: Accepted

Solution code:
n, m, cx, cy = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.append(cx)
y.append(cy)
if(max(x) < min(y)) : print("No War")
else : print("War")

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))  # リスト入力（数値）  map関数はリストの各要素に対して関数を適用してくれる
y = list(map(int, input().split()))  # リスト入力（数値）  map関数はリストの各要素に対して関数を適用してくれる

minX = max(x) + 1
maxY = min(y)

if X < minX and maxY <= Y and minX <= maxY:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
N,M,X,Y=map(int,input().split())
# N:Aの入力される座標数
# M:Bの入力される座標数
# X:Aの座標
# Y:Bの座標
x=list(map(int,input().split()))
y=list(map(int,input().split()))

if max(x)<min(y):
 for Z in range(max(x)+1,min(y)+1):
     if X<Z<=Y:
         print("No War")
         break
     else:
         print("War")
         break
else:
  print("War")

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
x = [int(_) for _ in input().split()]
y = [int(_) for _ in input().split()]
flag = False

x = sorted(x)
y = sorted(y)

if max(x) < min(y) and max(x) < Y and X < min(y):
    flag = True

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

Submission status: Accepted

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

Submission status: Accepted

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, max(x))
my = min(Y, min(y))
[print("No War" if mx < my else "War")]

Submission status: Accepted

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)
for z in range(-100, 101):
    if mx < z <= my and X < z < Y:
        print("No War")
        exit()
print("War")

Submission status: Accepted

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_list.sort()
y_list.sort()
xmax = x_list[n-1]
ymin = y_list[0]

if ymin - xmax >= 1 and x < ymin and xmax+1 < y and y - x > 1:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
NY=input().split()
N=int(NY[0]);M=int(NY[1]);X=int(NY[2]);Y=int(NY[3])
xs=input().split()
xs=[int(x) for x in xs]
ys=input().split()
ys=[int(y) for y in ys]
if X<Y and max(xs)<min(ys):
  if min(ys)<(X+1) or Y<(max(xs)+1):
    print("War")
  else:
    print("No War")
else:
  print("War")

Submission status: Accepted

Solution code:
# S = input()
# print('Heisei' if S <= '2019/04/30' else 'TBD')

# n,m,c=map(int,input().split())
# b=list(map(int,input().split()))
# e = [[int(i) for i in input().split()] for i in range(n)]

# array=[None]*3
# print(array)

# print('{0:.10f}'.format(11))

n,m,x,y=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
xmax=-1000
ymin=1000

for i in range(0,n):
	if a[i]>xmax:
		xmax=a[i]

for i in range(0,m):
	if b[i]<ymin:
		ymin=b[i]

flag=0

for t in range(x+1,y+1):
	if xmax<t:
		if ymin>=t:
			flag=1
			break

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

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().split())
xn=list(map(int,input().split()))
yn=list(map(int,input().split()))
xn.sort()
yn.sort()
z=yn[0]
if x<z<y and xn[-1]<z and yn[0]>=z:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
def main110():
    N, M, X, Y = (int(x) for x in input().split())

    a = list(map(int, input().split()))
    b = list(map(int, input().split()))

    if min(b) - max(a) >= 1:
        if max(a)+1 > X and max(a)+1 > Y:
            print("War")
        elif min(b) < X and min(b) < Y:
            print("War")
        elif max(a)+1 == X or min(b) == Y:
            print("War")
        else:
            print("No War")
    else:
        print("War")

main110()

Submission status: Accepted

Solution code:
N,M,X,Y=map(int,input().split())
Listx=list(input().split())
for i in range(N):
    Listx[i]=int(Listx[i])
Listx.sort()
Listy=list(input().split())
for i in range(M):
    Listy[i]=int(Listy[i])
Listy.sort()
low=max(X,Listx[N-1])
hight=min(Y,Listy[0])
if low<hight:
    print('No War')
else:
    print('War')

Submission status: Accepted

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('War')
elif max(max(x),X)<min(min(y),Y):
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
n,m,x,y = map(int,input().split())
X = list(map(int,input().split()))
Y = list(map(int,input().split()))
for z in range(-100,101):
    if x < z <= y and max(X) < z <= min(Y):
        print("No War")
        exit()

print("War")

Submission status: Accepted

Solution code:
n, m, x, y = map(int, input().split())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
xs.append(x)
ys.append(y)
print('No War' if max(xs) < min(ys) else 'War')

Submission status: Accepted

Solution code:
n,m,x,y = map(int,input().split())
xs = max(list(map(int,input().split())))
ys = min(list(map(int,input().split())))
ans = 'War'
if xs+1 <= ys:
    for i in range(xs+1,ys+1):
        if x < i <= y:
            ans = 'No War'
            break
print(ans)

Submission status: Accepted

Solution code:
N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
z1=max(x)+1
z2=min(y)
flag=False
if z1>z2:
    print('War')
else:
    for i in range(z1,z2+1):
        if X<i<=Y:
            flag=True
            break
    if flag:
        print('No War')
    else:
        print('War')

Submission status: Accepted

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

for i in range(N):
 X[i] = int(X[i])
for i in range(M):
 Y[i] = int(Y[i])
X.sort()
Y.sort()

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

Submission status: Accepted

Solution code:
N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
Z1=list(int(i) for i in range(X+1,Y+1))
Z2=list(int(j) for j in range(max(x)+1,min(y)+1))
if len(list(set(Z1)&set(Z2)))>0:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
# coding: utf-8
_, _, X, Y = map(int, input().split())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
rx = X
ry = Y
for x in xs:
    if rx < x:
        rx = x
for y in ys:
    if ry > y:
        ry = y
print(['No War', 'War'][ry - rx < 1])

Submission status: Accepted

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_max = max(X, max(x))
Z = x_max + 1

if Y < Z or min(y) < Z:
    print("War")
else:
    print("No War")

Submission status: Accepted

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

xmax = max(x)
ymin = min(y)

if X <= Y:
    for Z in range(X+1,Y+1,1):
        if xmax < Z <= ymin:
            print('No War')
            exit()
    print('War')
else:
    print('War')

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.append(X)
x.sort(reverse = True)
y.append(Y)
y.sort()
if x[0] < y[0]:
  print("No War")
else:
  print("War")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
Xi = list(map(int, input().split()))
Yi = list(map(int, input().split()))
Xi.append(X)
Yi.append(Y)
xm = max(Xi)
ym = min(Yi)

if xm < ym:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
can=False
for Z in range(X+1,Y+1):
    if max(x)<Z<=min(y):
        can=True
if can:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
x_list = list(map(int, input().split())) + [X]
x_list.sort()
y_list = list(map(int, input().split())) + [Y]
y_list.sort()
if max(x_list) < min(y_list):
    print('No War')
else:
    print('War')

Submission status: Accepted

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

    for i in range(max(x)+1, min(y)+1):
        if X < i and i <= Y:
            print('No War')
            exit()

    print('War')


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18

N,M,X,Y=rl()
x=rl()
y=rl()
x_ = max(x+[X])
y_ = min(y+[Y])

if x_ < y_:
    print('No War')
else:
    print('War')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def one_dimensional_worlds_tale(
        N: int, M: int, X: int, Y: int, x: list, y: list) -> bool:
    border_x = max([X] + x)
    border_y = min([Y] + y)
    return border_x < border_y


if __name__ == "__main__":
    N, M, X, Y = map(int, input().split())
    x = [int(s) for s in input().split()]
    y = [int(s) for s in input().split()]
    ans = one_dimensional_worlds_tale(N, M, X, Y, x, y)
    print('War' if not ans else 'No War')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

N, M, X, Y = map(int, input().split())
Xl = list(map(int, input().split())) + [X]
Yl = list(map(int, input().split())) + [Y]

print("No War" if max(Xl) < min(Yl) else "War")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

N, M, X, Y = map(int, input().split())
Xl = list(map(int, input().split())) + [X]
Yl = list(map(int, input().split())) + [Y]

if max(Xl) < min(Yl):
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
n, m, x, y = map(int, input().split())
x_city=list(map(int, input().split()))
y_city=list(map(int, input().split()))
x_city.append(x)
y_city.append(y)
x_city.sort()
y_city.sort()
if x_city[-1]<y_city[0]:
    print('No War')
else:
    print('War')

Submission status: Accepted

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()
Zx = x[-1] + 1
Zy = y[0]
flag = True
if Zx <= Zy:
    for z in range(Zx, Zy+1):
        if X < z and z<= Y:
            flag = False
            break
if flag:
    print("War")
else:
    print("No War")

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc110/tasks/abc110_b
n, m, x, y = [int(x) for x in input().split()]
xc = [int(x) for x in input().split()]
yc = [int(x) for x in input().split()]
if min(yc) - max(xc) < 1:
    print("War")
    exit()
if (y - max(xc) < 1) or (min(yc) - x < 1):
    print("War")
    exit()
print("No War")

Submission status: Accepted

Solution code:
N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
tmp = list(range(X+1,Y+1))
tmp2 = list(range(max(x)+1,min(y)+1))
if list(set(tmp) & set(tmp2)) == []:
  print('War')
else:
  print('No War')

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
x_lst = list(map(int, input().split()))
y_lst = list(map(int, input().split()))
if (X < Y and max(x_lst) < min(y_lst) and X < min(y_lst) and max(x_lst) < Y):
  print("No War")
else:
  print("War")

Submission status: Accepted

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

Submission status: Accepted

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("No War")
else:
    print("War")

Submission status: Accepted

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

X = list(map(int,input().split()))
Y = list(map(int,input().split()))

c = 0

for i in range(x+1,y+1):
	if max(X) < i <= min(Y):
		c += 1

if c != 0:
	print('No War')
else:
	print('War')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math
N, M, X, Y = [int(i) for i in input().split()]
x_ls = [int(i) for i in input().split()]
y_ls = [int(i) for i in input().split()]
max_x = max(x_ls)
min_y = min(y_ls)
flg = 0
for z in range(int(math.ceil(X + 0.00001)), int(Y)):
    if max_x < z <= min_y:
        flg = 1
if flg > 0:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
N,M,X,Y = map(int,input().split())
xs = list(map(int,input().split()))
ys = list(map(int,input().split()))
print(['War','No War'][max([X]+xs)<min([Y]+ys)])

Submission status: Accepted

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

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

if x_max >= y_min or x_max >= Y or y_min <= X + 1:
    print('War')
else:
    print('No War')

Submission status: Accepted

Solution code:

# coding: utf-8

# In[29]:


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


# In[30]:


x.append(X)
sorted_x = sorted(x)
y.append(Y)
sorted_y = sorted(y)


# In[31]:


if sorted_x[-1] < sorted_y[0]:
    print("No War")
else:
    print("War")

Submission status: Accepted

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

Submission status: Accepted

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

if min(yl)-max(xl)>0:
    if min(yl)<=Y and min(yl)>X:
        ans = 'No War'
    else:
        ans = 'War'
else:
    ans = 'War'
    
print(ans)

Submission status: Accepted

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

def war(Z):
  for i in range(N):
    if x[i] >= Z:
      return False
  for i in range(M):
    if y[i] < Z:
      return False
  return True

ans = "War"
for i in range(X + 1, Y + 1):
  if war(i):
    ans = "No War"
    break
print(ans)

Submission status: Accepted

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)

def is_war(z):
  if x_max < z and y_min >=z and x<z and z<=y:
    return True
  else:
    return False

flag = False
for i in range(-100,100,1):
  if is_war(i):
    flag = True
print("No War" if flag else "War")

Submission status: Accepted

Solution code:
def solve(string):
    N, M, X, Y, *xy = map(int, string.split())
    x, y = xy[:N], xy[N:]
    max_x = max(x)
    min_y = min(y)
    if min_y <= max_x or min_y <= X or Y <= max_x:
        return "War"
    else:
        return "No War"


if __name__ == '__main__':
    print(solve("\n".join([input(), input(), input()])))

Submission status: Accepted

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<Y:
  if len(set(range(max(x)+1,min(y)+1))&set(range(X+1,Y+1)))>=1:
  	print('No War')
  else:
    print('War')
else:
  print('War')

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
xlist = sorted([int(x) for x in input().split()])
ylist = sorted([int(y) for y in input().split()])

flg = 'War'
if X >= Y:
    pass    
else:
    for z in range(X+1, Y+1):
        if xlist[-1] < z and ylist[0] >= z:
            flg = 'No War'

print(flg)

Submission status: Accepted

Solution code:
n,m,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
temp=False
if Y-X>0:
    for i in range(X+1,Y):
        if max(x)<i and i<=min(y):
            temp=True
            break
if temp==False:
    print("War")
else:
    print("No War")

Submission status: Accepted

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

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

x.append(X)
y.append(Y)

max_x = max(x)
min_x = min(x)

for i in range(len(y)):
    if max_x >= y[i] and min_x <= y[i]:
        print('War')
        exit()
print('No War')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
n,m,x,y = map(int, input().split())
xl=list(map(int, input().split()))
yl=list(map(int, input().split()))

xl.sort()
yl.sort()

yr=min(yl[0],y)

if xl[-1]<yr and x<yr:
  print('No War')
else:
  print('War')

Submission status: Accepted

Solution code:
n,m,x,y = map(int,input().split())
lix = [int(xn) for xn in input().split()]
liy = [int(yn) for yn in input().split()]
cnt = 0
if y - x < 1:
    cnt = 0
else:
    for i in range(x + 1, y + 1):
        if min(liy) - i >= 0 and i - max(lix) >= 1:
            cnt = 1
        
if cnt == 1:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
x = [int(i) for i in input().split()]
y = [int(j) for j in input().split()]
if max(x) < min(y) and max(x) < Y and min(y) > X:
  print('No War')
else:
  print('War')

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
lst1 = sorted(map(int, input().split()))
lst2 = sorted(map(int, input().split()))
Z = int(lst2[0])
if  X < Z <= Y and int(lst1[-1]) < Z:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().split())
xlist=[int(i) for i in input().split()]
ylist=[int(i) for i in input().split()]
xlist.append(x)
ylist.append(y)

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

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().split())
xl=list(map(int,input().split()))
yl=list(map(int,input().split()))
 
xl.append(x)
yl.append(y)
if max(xl) < min(yl) and x < y:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
(*_,X,Y),x,y=eval('map(int,input().split()),'*3);print('No'*(max(X,*x)<min(Y,*y)),'War')

Submission status: Accepted

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

ans = 'No War' if max([X]+x) < min([Y]+y) else 'War'
print(ans)

Submission status: Accepted

Solution code:
n, m, x, y = map(int, input().split())
xl = [int(i) for i in input().split()]
yl = [int(i) for i in input().split()]
xl.append(x)
yl.append(y)

if(max(xl) < min(yl)):
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:

n, m, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.append(X)
y.append(Y)

for i in range(len(x)):
	for j in range(len(y)):
		if (x[i] == y[j]):
			print('War')
			exit()

if max(x) >= min(y):
	print('War')
	exit()

print('No War')

Submission status: Accepted

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

flag=False

if max(xl)>=min(yl):
    pass
else:
    l=range(max(xl)+1,min(yl)+1)
    for i in range(len(l)):
        if x<l[i]<=y:
            flag=True
        else:
            pass

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

Submission status: Accepted

Solution code:
(*z,X,Y),x,y=eval('map(int,input().split()),'*3);print('No War'[3*(max(X,*x)>=min(Y,*y)):])

Submission status: Accepted

Solution code:
n,m,x,y = map(int,input().split())
x_list = list(map(int,input().split()))
x_list.append(x)
y_list = list(map(int,input().split()))
y_list.append(y)
if max(x_list) < min(y_list):
    print('No War')
else:
    print('War')

Submission status: Accepted

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

X=list(map(int,input().split()))
Y=list(map(int,input().split()))

X.append(x)
X.sort()
Y.append(y)
Y.sort()

if max(X)<min(Y):
    print('No War')
else:
    print('War')

Submission status: Accepted

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