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())
xl = list(map(int,input().split()))
yl = list(map(int,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)
if max(x)<min(y):
    ans='No 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()))
print("No War" if min(Y,min(y)) > max(X,max(x)) else "War")

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_list.append(X)
y_list.append(Y)

max_x = max(x_list)
min_y = min(y_list)

for i in range(X, Y + 1):
    if max_x < i and i <= min_y:
        print('No War')
        break
    else:
        pass
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()))
a=max(x)
a=max(a,X)
b=min(y)
b=min(b,Y)
if a<b:
  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()))
flag = 0

Z_max = min(y)
Z_min = max(x)
Z = X + 1
while Z < Y:
    if Z_min < Z and Z <= Z_max:
        break
    Z += 1

for i in range(N):
    if x[i] >= Z:
        flag = 1
        break

if flag == 0:
    for i in range(M):
        if y[i] < Z:
            flag = 1
            break

if flag == 0:
    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)
x.sort()
y.sort()

if x[N] < y[0]:
    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()))

print('War' if max(XL) >= min(YL) \
    or X >= min(YL) or Y <= max(XL) else 'No War')

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())  # Aの支配下数N, Bの支配下数M, Aの首都X, Bの首都Y

domi_x = list(map(int, input().split()))
domi_y = list(map(int, input().split()))

domi_x.append(X)
domi_y.append(Y)

max_x = max(domi_x)
min_y = min(domi_y)

if min_y > max_x:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
NMXY = list(map(int, input().split(' ')))

N = list(map(int, input().split(' ')))

M = list(map(int, input().split(' ')))

if ( NMXY[2] < min(M) and NMXY[3] >= min(M) ) :
  if ( max(N) < min(M) ):
    print('No War')
  else :
    print('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 max(x, X[-1]) < min(y, Y[0]):
    print('No War')
else:
    print('War')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,M,X,Y=map(int,input().split())
XX=max(list(map(int,input().split())))
YY=min(list(map(int,input().split())))
c=0

for i in range(X+1,Y+1):
    if i>XX and i<=YY:
        c=1
print(['War','No War'][c])

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()
l=[]
for i in range(X+1,Y):
  if x[-1]<i and y[0]>=i:
    l.append(i)

if l!=[]:
  print('No War')
else:
  print('War')

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().split())
x1=list(map(int,input().split()))
y1=list(map(int,input().split()))
if min(y1)-max(x1)>=1 and max(x1)<y and min(y1)>x:
    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[-1] < 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 = list(map(int, input().split()))
y = list(map(int, input().split()))

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

Submission status: Accepted

Solution code:
# B
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)
ans = "War"
Xmax = max(x)
Ymin = min(y)
# print("X",X)
# print("Y",Y)
# print("Xmax",Xmax)
# print("Ymin",Ymin)
# 1
if Xmax < Ymin:
    ans = "No War"
print(ans)

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)+1
y_min=min(y)+1

flg=True

for z in range(x_max,y_min):
    if X<z<=Y:
        flg=False
        break
print("War" if flg else "No War")

Submission status: Accepted

Solution code:
import sys
n,m,x,y = map(int,input().split())
x_li = list(map(int,input().split()))
y_li = list(map(int,input().split()))
for z in range(x+1,y+1):
    if z>x and z>max(x_li) and z<=y and z<=min(y_li):
        print('No War')
        sys.exit()
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()))

max_x = max(x)
max_y = max(y)
min_y = min(y)
#print(max_x)
#print(max_y)
#print(Y-X)

XY_list = []
xy_list = []
for i in range(X+1, Y+1):
    XY_list.append(i)

if max_x   >= min_y:
    print("War")
    exit()

for i in range(max_x +1, min_y+1):
    xy_list.append(i)

#print(XY_list)
#print(xy_list)
set_XY = set(XY_list)
set_xy = set(xy_list)

print("No War" if set_XY & set_xy else "War")

Submission status: Accepted

Solution code:
def main():
    N,M,X,Y = map(int, input().split())
    x_wants=[int(s) for s in input().split()]
    y_wants=[int(s) for s in input().split()]

    x_wants.append(X)
    y_wants.append(Y)
    x_wants = sorted(x_wants)
    y_wants = sorted(y_wants)

    x_max = x_wants[len(x_wants)-1]
    y_min = y_wants[0]

    if((y_min-x_max)<1):
        print('War')
        return
    
    print('No 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()))
for i in range(X+1,Y+1):
    for j in range(n):
        if i <= x[j]:
            break
    else:
        for k in range(m):
            if y[k] < i:
                break
        else:
            print('No War')
            break
else:
    print('War')

Submission status: Accepted

Solution code:
_,_,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
k=max(x)
l=min(y)
print('No War' if X<l and k<Y and k<l else '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())))

mixture = X + Y
sorted_mix = sorted(mixture)
if x > y:
    print("War")
    exit()

for i, j in zip(mixture, sorted_mix):
    if i != j:
        print("War")
        exit()

max_X = max(max(X), x)
min_Y = min(min(Y), y)

if max_X >= min_Y:
    print("War")
    exit()

print("No War")

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)


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

    arr = x + y
    arr = [i for i in arr if X < i < Y]
    arr = [i for i in arr if x[-1] < i]
    arr = [i for i in arr if y[0] >= i]

    if arr:
        print('No War')
    else:
        print('War')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
x_array = list(map(int, input().split()))
y_array = list(map(int, input().split()))
x_array.append(X)
y_array.append(Y)
if max(x_array)<min(y_array):
    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_max = -101
for i in range(N):
    if x[i] > x_max:
        x_max = x[i]
y_min = 100
for i in range(M):
    if y[i] < y_min:
        y_min = y[i]
count = 0
for z in range(X+1,Y+1):
    if x_max < z:
        if z <= y_min:
            count = 1

if count:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().split())
xi=[int(_) for _ in input().split()]+[x]
yi=[int(_) for _ in input().split()]+[y]
print('War' if max(xi) >= min(yi) else 'No War')

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().split())
xi=[int(_) for _ in input().split()]
yi=[int(_) for _ in input().split()]
print('War' if max(xi) >= min(yi) or x >= y  or max(xi) >= y or min(yi) <= x else 'No War')

Submission status: Accepted

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

if x >= y or Lx[-1] >= Ly[0] or Lx[-1] >= y or Ly[0] <= x:
        print('War')
else:
        print('No War')

Submission status: Accepted

Solution code:
import os, sys, re, math

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

x_ary = list(map(int,input().split(' ')))
y_ary = list(map(int,input().split(' ')))
x_ary.sort()
y_ary.sort()

flg = False
for i in range(x_ary[-1], y_ary[0]):
    if i > X and i < Y:
        flg = True
        break
if flg:
    print('No War')
else:
    print('War')

Submission status: Accepted

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

print("War" if max(listX)>=min(listY) else "No 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()]
x.append(X)
y.append(Y)
x.sort(reverse=True)
y.sort()
print('No War' if x[0]<y[0] 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 X >= Y:
    print('War')
    exit()
for i in range(X+1, Y+1):
    if max(x) < i and min(y) >= i:
        print('No War')
        exit()
print('War')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline


def main():
    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 Z in range(X+1, Y+1):
        if x[N-1]<Z and y[0]>=Z:
            ans = "No War"
    
    print(ans)

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()))
flg = 'War'
for i in range(X+1, Y+1):
	if max(x) < i and i <= min(y):
		flg = 'No ' + flg
		break
print(flg)

Submission status: Accepted

Solution code:
n, m, x, y = [int(a) for a in input().split()]
left = max([int(l) for l in input().split()] + [x])
right = min([int(r) for r in input().split()] + [y])
print ('No War' if left < right else 'War')

Submission status: Accepted

Solution code:
import os, sys, re, math

(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.append(X)
y.append(Y)
x.sort()
y.sort()

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

Submission status: Accepted

Solution code:
line = raw_input()
N, M, X, Y = [int(s) for s in line.split(' ')]
line = raw_input()
xn = [int(s) for s in line.split(' ')] + [X]
line = raw_input()
ym = [int(s) for s in line.split(' ')] + [Y]

x_edge = max(xn)
y_edge = min(ym)

print 'No War' if x_edge < y_edge else 'War'

Submission status: Accepted

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

Submission status: Accepted

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

print('War' if max(xs + [X]) >= min(ys + [Y]) else 'No 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()))
zs = (max(xs), min(ys))
ans = "War"
if zs[0] < zs[1]:
  if x < zs[0] and zs[0] < y:
    ans = 'No War'
  if x < zs[1] and zs[1] <= y:
    ans = 'No War'
print(ans)

Submission status: Accepted

Solution code:
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
if max(A[2],max(B)) >= min(A[3],min(C)):
  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()))
Z='War'
for i in range(X+1,Y+1):

    if max(x)< i <= min(y) :

        Z='No War'

    else:

        continue

print(Z)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def main():
    n, m, X, Y = map(int, input().split())
    x = list(map(int, input().split()))
    y = list(map(int, input().split()))
    war = "War"
    for z in range(X + 1, Y + 1):
        if all([i < z for i in x]) and all([i >= z for i in y]):
            war = "No War"
            break

    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()))
x.append(X)
y.append(Y)
x.sort(reverse = True)
y.sort()
#print(x[0],y[0])
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()))

max_x = max(x)
min_y = min(y)

if max_x < Y and max_x < min_y and min_y > X:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
import sys
N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
for i in range(X+1,Y+1):
    if max(x) < i <= min(y):
        print("No War")
        sys.exit()
print("War")

Submission status: Accepted

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

if X[-1] < Y[0]:
  print("No War")
else:
  print("War")

Submission status: Accepted

Solution code:
N, M, X, Y =list(map(int,input().split()))
x = [i for i in map(int, input().split())]        
y =[i for i in map(int, input().split())]
x_max =max(x)
y_min =min(y)

# X<Z<=Y を満たす数を列挙
for Z in range(X+1,Y+1):

  # x1, x2, ... , xn < Z <= y1, y2, ... , yn の判定
  if x_max<Z and Z<=y_min:
    print('No War')
    exit()

# 条件を満たすZが存在しない場合
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) and X < min(y) <= Y:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
# B - 1 Dimensional World's Tale
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

for i in range(-100, 100):
    if X < i <= Y and max(x) < i <= min(y):
        print('No War')
        exit()
    else:
        pass
print('War')

Submission status: Accepted

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

a=[]
for i in range(2):
    b=list(map(int,input().split()))
    a.append(b)

ans=False
for i in range(X,Y+1):
    if i > X and i <= Y:
        if max(a[0]) < i and min(a[1]) >= i:
            ans=True

if ans:
    print('No War')
else:
    print('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()))

startWar = True
for Z in range(X+1, Y+1):
    warOccur = False
    if max(x) < Z:
        pass
    else:
        warOccur = True

    if Z <= min(y):
        pass
    else:
        warOccur = True

    if warOccur == True:
        continue
    else:
        startWar = False
        break

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

Submission status: Accepted

Solution code:
N, M, X, Y = map(int,input().split())
x = sorted(map(int,input().split()))
y = sorted(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())
x=list(map(int,input().split()))
y=list(map(int,input().split()))

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

max_x = max(x)
min_y = min(y)

if min_y <= max_x:
  print("War")
else:#max_xとmin_yの間の数が存在する。それがXとYの間という条件も満たせばOK
  if Y <= max_x:
    print("War")
  elif X >= min_y:
    print("War")
  else:
    print("No War")

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(5 * 10**5)
input = sys.stdin.readline

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 min(y) - max(x) >= 1:
    print("No War")
else:
    print("War")

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("No War" if x < y and X < y and x < Y else "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())))
maxx = max(x)
miny = min(y)
for z in range(1, Y - X + 1):
  if X + z > maxx and X + z <= miny:
    print("No War")
    exit(0)
print("War")

Submission status: Accepted

Solution code:
ni = lambda: int(input())
nl = lambda: list(map(int, input().split()))
nm = lambda: map(int, input().split())

n, m, x, y = nm()
xmax = max(nl()+[x])
ymin = min(nl()+[y])

if xmax < ymin:
    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()))
def check(xs,ys,z):
    for x in xs:
        if z<=x:
            return
    for y in ys:
        if z>y:
            return 0
    return 1
if min(ys)<=max(xs):
    print("War")
else:
    f=1
    for z in range(max(xs)+1, min(ys)+1):
        if X<z and Y>=z:
            f=0
            print("No War")
            break
    if f:
        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 i in range(X+1, Y+1):
  if X < i <= Y and max(x) < i and min(y) >= i:
    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()))+[X]
y=list(map(int, input().split()))+[Y]

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

for Z in range(X+1, Y+1):
    result = True
    for xi in x:
        if xi >= Z:
            result = False
            break

    for yi in y:
        if yi < Z:
            result = False
            break
    if result:
        print('No War')
        break
else:
    print('War')

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()))

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

Submission status: Accepted

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

for i in range(X + 1, Y + 1):
    if x < 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()))
output = "War"
mx = max(X)
my = min(Y)

for i in range(x + 1, y + 1):
    if mx < i <= my:
        output = "No War"

print(output)

Submission status: Accepted

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

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

Submission status: Accepted

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

print('No War' if min(z2,Y)>max(z1,X) else 'War')

Submission status: Accepted

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()
if xlist[-1]<ylist[0] and xlist[-1]>x and ylist[0]<=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.sort(reverse=True)
y.sort()
ans = "War"
for i in range(X+1,Y+1):
    if x[0]<i<=y[0]:
        ans = "No War"
        break
    else:
        continue
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()))	
ans="War"
for Z in range(X+1,Y+1):
    if( max(x)<Z and Z<=min(y)):
        ans="No War"
        break
print(ans)

Submission status: Accepted

Solution code:
N,M,X,Y = map(int,input().split())
A = list(map(int,input().split()))
A = sorted(A)
B = list(map(int,input().split()))
B = sorted(B)
if X<Y and A[-1]<B[0]:
    if Y<=A[-1] or X>=B[0]:
        print("War")
    else:
        print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    N, M, X, Y = map(int, input().split())
    X_new = list(map(int, input().split()))
    Y_new = list(map(int, input().split()))
    X_new.append(X)
    Y_new.append(Y)
    X_new.sort()
    Y_new.sort()
    

    if X_new[N] < Y_new[0]:
        print('No War')
    else:
        print('War')

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,m,x,y=map(int,input().split())
    max_x=max(map(int,input().split()))
    min_y=min(map(int,input().split()))
    print("No War" if x<min_y<=y and max_x<min_y else "War")
resolve()

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
print('No War'if max(a)<min(b)and x<min(b)<=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()))
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())
ls_x = list(map(int, input().split()))
ls_y = list(map(int, input().split()))

x = max(max(ls_x), x)
y = min(min(ls_y), y)

print('No War' if x < y else 'War')

Submission status: Accepted

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

if max(ls_x) < y and min(ls_y) > x and max(ls_x) < min(ls_y):
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
N,M,X,Y = [int(x) for x in input().split()]
x = [int(x) for x in input().split()]
x.sort()
y = [int(x) for x in input().split()]
y.sort()
for i in range(x[-1]+1,y[0]+1):
  if X<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()))

X.sort()
Y.sort()

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

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
if x<y and max(a)<min(b) and max(a)<y and x<min(b) :
    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()))
count=0
for i in range(X+1,Y+1):
  if max(x)<i<=min(y):
    count+=1
if count==0:
  print("War")
else:
  print("No War")

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

if x_list[-1] >= y_list[0]:
    print('War')
else:
    z_list = [z for z in range(x_list[-1], y_list[0]+1)]
    z_list.sort()
    if z_list[0] <= X or z_list[-1] > Y:
        print('War')
    else:
        print('No 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()))

x, y = max(xs), min(ys)
print("No War" if y - x >= 1 and X < y < Y else "War")

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
Xs = [int(a) for a in input().split()]
Ys = [int(a) for a in 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())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.append(X)
y.append(Y)
# print(x)
# print(y)
print("No War" if max(x)<min(y) else "War")
# if max(x) < min(y):
#     print('No war')
# else:
#     print('War')

Submission status: Accepted

Solution code:
n, m, x, y = map(int, input().split())
xMax = max(map(int, input().split()))
yMin = min(map(int, input().split()))
swi = "No War"

if yMin < xMax+1:
    swi = "War"
else:
    for i in range(xMax+1, yMin+1):
        if not(x+1 <= i <= y):
            swi = "War"
            break
print(swi)

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:
# ABC110b
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

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

if (max(max(x), X) < min(min(y), 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()))

for z in range(X+1, Y+1):
    if all(map(lambda _x: _x < z, x)) and all(map(lambda _y: _y >= z, y)):
        print("No War")
        quit()

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:
# -*- coding: utf-8 -*-
from math import sin, cos, radians

def main():
    N,M,X,Y  = map(int, input().split())
    x_ = list(map(int, input().split()))
    y_ = list(map(int, input().split()))
    if max(X,*x_)<min(Y,*y_):
        print("No War")
    else:
        print("War")
    # print(max(Y,*y_))
    

if __name__ == '__main__':
    main()

Submission status: Accepted

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

xl = [int(i) for i in input().split()]
yl = [int(i) for i in input().split()]

x_max = max(xl)
y_min = min(yl)
z = {i for i in range(x+1,y+1)}
x_y_interval = {i for i in range(x_max+1,y_min+1)} 


if not x_y_interval:
    print('War')
elif z &x_y_interval:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
def war():
  print('War')
  exit()

def nowar():
  print('No War')
  exit()
  
N,M,X,Y= map(int, input().split())
if Y -X < 1: war()

xmax = max(list(map(int,input().split())))
ymin = min(list(map(int,input().split())))
for z in range(X+1,Y+1):
  if xmax < z and ymin >= z: nowar()

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()))
maxx=max(x)
miny=min(y)

ans=0
for i in range(maxx+1,miny+1):
  if i>X and i<=Y:
    ans=1
    break
print("No War" if ans 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()))
ans = 'War'
for i in range(X+1, Y+1):
  if max(x) < i and i <= min(y):
    ans = 'No War'

print(ans)