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:
#coding:utf-8

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

'''
result1 = (X < Z) and (Z <= Y)

num_violate2 = len([i for i in x if i >= Z])
if num_violate2 > 0:
    result2 = False
else:
    result2 = True

num_violate3 = len([i for i in x if i < Z])
if num_violate3 > 0:
    result3 = False
else:
    result3 = True

if result1 and result2 and result3:
    print('No War')
else:
    print('War')
'''

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

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

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

Submission status: Accepted

Solution code:
# ABC110B - 1 Dimensional World's Tale
n, m, x, y = list(map(int, input().rstrip().split()))
x_data = list(map(int, input().rstrip().split()))
y_data = list(map(int, input().rstrip().split()))
x_data.append(x)
y_data.append(y)

print("No War" if max(x_data) < min(y_data) else "War")

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().rstrip().split())
x = list(map(int, input().rstrip().split()))
y = list(map(int, input().rstrip().split()))
x = max(x)
y = min(y)
Z = [i for i in range(x+1, y+1)]
ans = "War"
for z in Z:
    if z > X and Y >= z:
        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()))

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())
lstx=list(map(int,input().split()))
lsty=list(map(int,input().split()))

flag=False
for z in range(x+1,y):
    if max(lstx)<z and min(lsty)>=z:
        flag=True

if flag:
    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())

if not X <= Y:
	print("War")
	exit()

if not max(x + [X]) < min(y + [Y]):
	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()))
ans = "War"
for Z in range(X + 1, Y + 1):
	if max(x) < Z <= min(y):
		ans = "No War"
		break
print(ans)

Submission status: Accepted

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

xmax = max(xs)
ymin = min(ys)


zs = [i for i in range(X+1,Y+1)]
warflg = True
for z in zs:
    if xmax<z and z<=ymin:
        warflg = False

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

Submission status: Accepted

Solution code:
# def makelist(n, m):
#     return [[0 for i in range(m)] for j in range(n)]

yes = "War"
no = "No War"

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) + 1 <= min(y):
    print(no)
else:
    print(yes)

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(X, max(x))
y = min(Y, min(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()))
X.append(x)
Y.append(y)
print("No War" if max(X)<min(Y) else "War")

Submission status: Accepted

Solution code:
N, K, A, B = list(map(int, input().split()))
A_max = max(list(map(int, input().split())))
B_min = min(list(map(int, input().split())))

if A_max > A and B_min <= B and A_max < B_min:
  print("No War")
else:
  print("War")

Submission status: Accepted

Solution code:


def main():
    N, M, X, Y = map(int, input().split())
    x_data = list(map(int, input().split()))
    y_data = list(map(int, input().split()))

    z = min(Y, min(y_data))
    if max(X, max(x_data)) < z:
        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()))

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

if xmax >= ymin or xmax >= Y or ymin <= X:
    print('War')
else:
    print('No War')

Submission status: Accepted

Solution code:
input1 = input().split()
input2 = list(map(int,input().split()))
input3 = list(map(int,input().split()))
N = int(input1[0])
M = int(input1[1])
X = int(input1[2])
Y = int(input1[3])
max2 = max(input2)
min3 = min(input3)

OK = 0
for Z in range(-100,100+1):
    if X < Z <= Y and max2 < Z and min3 >= Z :
        OK = 1
    else :
        pass

if OK == 1 :
    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()))
xmin=max(x)
ymin=min(y)
for i in range(X+1,Y+1):
    if xmin<i<=ymin:
        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)
print(("No " if max(x)<min(y) else "" )+"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)
if min(ys) <= max(xs):
    print('War')
else:
    print('No War')

Submission status: Accepted

Solution code:
N,M,X,Y=map(int,input().split())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
if max(X,max(A)) < min(Y,min(B)):
    print ("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, X: int, Y: int, x: "List[int]", y: "List[int]"):
    x = max(x + [X])
    y = min(y + [Y])
    if x < y:
        print("No War")
    else:
        print("War")
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    x = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    y = [int(next(tokens)) for _ in range(M)]  # type: "List[int]"
    solve(N, M, X, Y, x, y)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

# print(X, a)

x_max = max(a)
y_min = min(b)


# print(x_max, y_min)

count = 'War'


for i in range(X, Y + 1):
    if i > x_max and i <= y_min and i > X and i < Y:
        count = 'No War'

print(count)

Submission status: Accepted

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

xis = sorted(list(map(int,input().split())),reverse=True)
yis = sorted(list(map(int,input().split())))
 
ans = 'No War' if (xis[0] < yis[0]) and (x < yis[0] and xis[0] < y) else 'War'

print(ans)

Submission status: Accepted

Solution code:
#110 B
N,M,X,Y= map(int,input().split())
x =[int(j) for j in input().split()]
y =[int(j) for j in input().split()]
for i in range(-100,101):
    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())
Z = 300

x_list = [int(n) for n in input().split()]
y_list = [int(n) for n in input().split()]
if max(x_list) >= min(y_list):
    Z=300
else:
    for i in range(max(x_list)+1,min(y_list)+1):
        if X<i and i<=Y and max(x_list)<i and min(y_list)>=i:
            Z = i
print("War" if Z==300 else "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)
if max(x) < min(y):
  print('No War')
else:
  print('War')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left

def main():
	N, M, XX, YY = map(int, input().split(" "))
	X = input().split(" ")
	X = [int(s) for s in X]
	Y = input().split(" ")
	Y = [int(s) for s in Y]
	
	X.sort()
	Y.sort()
	
	if X >= Y:
		print("War")
		sys.exit()
	
	tmp = Y[0] - X[len(X)-1]
	if tmp < 1:
		print("War")
		sys.exit()
		
	for i in range(X[len(X)-1]+1, Y[0]+1):
		if i <= YY and XX < i:
			print("No War")
			sys.exit()
	
	print("War")
		
	
if __name__ == "__main__":
	main()

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

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

# print(x)
# print(y)

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

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

Submission status: Accepted

Solution code:
"""
map(int,input().split())

X = input().split()
x = []
for i in range(0,len(X)):
    x.append(X[i])

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

x = input().split()
xls = []

for n in range(0,N):
    xls.append(int(x[n]))

y = input().split()
yls = []

for n in range(0,M):
    yls.append(int(y[n]))

xls.sort()
yls.sort()

if xls[len(xls)-1] >= yls[0]:
    print("War")
elif yls[0] <= X:
    print("War")
elif xls[len(xls)-1] >= Y:
    print("War")
else:
    print("No War")

Submission status: Accepted

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

z = 100
z = max(x_want) + 1

if (x < z and z <= y) and (max(x_want) < z) and (min(y_want) >= z):
    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()))
y_list = list(map(int, input().split()))
max_x = max(x_list)
min_y = min(y_list)
for i in range(max_x + 1, min_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())
xlist=list(map(int,input().split()))
xlist=sorted(xlist)
ylist=list(map(int,input().split()))
ylist=sorted(ylist)

flag=False
for i in range(x+1,y+1):
  if xlist[-1] < i <= ylist[0]:
    flag=True
    break
if flag:
  print('No War')
else:
  print('War')

Submission status: Accepted

Solution code:
#ABC110 B 

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

#処理
isnotWar = False
if X < Y:
    for Z in range(X+1,Y+1): 
        if max(x) < Z and min(y) >= Z:
            isnotWar = True
            
if isnotWar:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
# /usr/bin/python
# -*- coding: utf-8 -*-
#
import math


n,m,x,y = map(int, input().split())
xn = max(list(map(int, input().split()))+[x])
yn = min(list(map(int, input().split()))+[y])

if xn < yn:
  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+1 <= Y:
    for Z in range(X+1, Y+1):
        if max(x) < Z and Z <= min(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_max  = max(x)
y_min = min(y)
if x_max >= y_min or x_max >= Y or y_min <= X:
    print("War")
else :
    print("No War")

Submission status: Accepted

Solution code:
n, m, x, y = list(map(int, input().split()))
x_li = list(map(int, input().split()))
y_li = list(map(int, input().split()))
ans_f = 0
for z in range(x + 1, y + 1):
    x_not_f = 0
    y_not_f = 0
    for i in x_li:
        if z <= i:
            x_not_f = 1
    for i in y_li:
        if z > i:
            y_not_f = 1
    if x_not_f == 0 and y_not_f == 0:
        ans_f = 1
        break

if ans_f == 1:
    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=max(map(int, input().split()))
y=min(map(int, input().split()))

c1 = set(range(X+1, Y+1))
c2 = set(range(x+1, y+1))

print("No War" if len(c1&c2) > 0 else "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 X < Y and  max(x) < min(y):
    f = True
else:
    f = False

if f:
    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 min(Y,min(y)) > max(X,max(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 z in range(101):
  if X<z<=Y and all(x[i]<z for i in range(n)) and all(y[j]>=z for j in range(m)):
    print('No War')
    sys.exit()
for z in range(1,101):
  if X<z*(-1)<=Y and all(x[i]<z*(-1) for i in range(n)) and all(y[j]>=z*(-1) for j in range(m)):
    print('No War')
    sys.exit()
print('War')

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, raw_input().split())
x = map(int, raw_input().split())
y = map(int, raw_input().split())
x.sort()
y.sort()
ans = 'War'
for i in range(X+1, Y+1):
	if x[N-1] < i and i <= y[0]:
		ans = 'No War'
		break

print ans

Submission status: Accepted

Solution code:
import sys

N, M, X, Y = map(int, input().split())
xx = list(map(int, input().split()))
yy = list(map(int, input().split()))

for z in range(X+1, Y+1):
    if all(x < z for x in xx) and all(y >= z for y in yy):
        print('No War')
        sys.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.append(X)
y.append(Y)
x.sort()
y.sort()
print('No War' if x[-1] < 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()))
x.sort()
y.sort()
z = []

if X < Y:
    for i in range(X+1, Y+1):
        z.append(i)
    for Z in z:
        if x[N-1] < Z <= y[0]:
            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()
y.append(Y)
y.sort()
print('No War' if x[-1] < y[0] else 'War')

Submission status: Accepted

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

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

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

# print(X, a)

x_max = max(a)
y_min = min(b)


# print(x_max, y_min)

count = 'War'


for i in range(X, Y + 1):
    if i > x_max and i <= y_min and i > X and i < Y:
        count = 'No War'

print(count)

Submission status: Accepted

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

if min(min(y), Y) - max(max(x), 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 i in range(X+1, Y+1):
    if i > max(x) and i <= min(y):
        print('No War')
        break
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(i) for i in 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())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))

xs.append(X)
ys.append(Y)

if max(xs) >= min(ys):
  war = "War"
else:
  war = "No War"

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

if max(xs) >= min(ys):
  war = "War"
elif max(xs) >= Y or min(ys) <= X:
  war = "War"
else:
  war = "No War"

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(i) for i in input().split()]
x_max = max(x)
y_min = min(y)
for z in range(x_max+1, y_min+1):
    if X < z and 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()))

dif = min(y) - max(x)

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

Submission status: Accepted

Solution code:
import math
n, m, x0, y0 = map(int, raw_input().split())
x = map(int, raw_input().split())
y = map(int, raw_input().split())

com = set(range(x0+1,y0+1)) & set(range(max(x)+1,min(y)+1))
if len(com) >= 1:
	print 'No War'
else:
	print 'War'

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

for z in range(X+1, Y+1):
    if max(xi) < z and min(yi) >= z:
        print('No War')
        quit()
 
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()))
x_list.append(x)
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())
xn = list(map(int, input().split()))
yn = list(map(int, input().split()))

for i in range(x+1, y+1):
    if all(x < i for x in xn) and all(y >= i for y in yn):
        print("No War")
        break
else:
    print("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()))
result =0
flag = 0
for i in range (X+1, Y+1):
    flag = 0
    for j in range (N):
        if A[j] >=i:
            flag=1
    for k in range (M):
        if B[k] <i:
            flag=1
    if flag ==0:
        result =1
        
if result !=1:
    print('War')
else:
    print('No War')

Submission status: Accepted

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

xsihai=list(map(int,input().split()))
ysihai=list(map(int,input().split()))

xsihai.append(x)
ysihai.append(y)


xsihai.sort()
ysihai.sort()

xmax=max(xsihai)
ymin=min(ysihai)


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

Submission status: Accepted

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

array_1 = [i for i in range(X + 1, Y + 1)]
array_2 = [i for i in range(max(x_targets) + 1, min(y_targets) + 1)]
array_and = set(array_1) & set(array_2)
if len(array_and) != 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()))

i = X + 1
while i < Y + 1:
    if max(x) < i and i <= min(y):
        print('No War')
        break
    else:
        i += 1
if i == Y + 1:
    print('War')

Submission status: Accepted

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

max_x = max(xs)
min_y = min(ys)
if max_x < min_y and min_y <= y and x < min_y:
  print("No War")
else:
  print("War")

Submission status: Accepted

Solution code:
from sys import exit
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(X+1,Y+1):
  if mx<z and z<=my:
    print('No War')
    exit()
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()))

def solve():
    for Z in range(-105,105):
        f = 1
        if not (X < Z and Z <= Y):
            f = 0
        for xx in x:
            if not xx < Z:
                f = 0
        for yy in y:
            if not yy >= Z:
                f = 0
        if f == 1:
            return True
    return False
print("No War" if solve() else "War")

Submission status: Accepted

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

for Z in range(X + 1, Y + 1):
    if max(X_list) < Z and Z <= min(Y_list):
        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()))

xmax = max(X)
ymin = min(Y)

ans = "War"

for i in range(-100,101):
    if xmax < i <= ymin and x < i <= y:
        ans = "No War"
        break

print(ans)

Submission status: Accepted

Solution code:
def z_is_exist(X, Y, x, y):
    cand = []
    for i in range(X + 1, Y + 1):
        if max(x) < i and min(y) >= i:
            return True
    return False
    

def main():
    N, M, X, Y = map(int, input().split())
    *x, = map(int, input().split())
    *y, = map(int, input().split())
    if z_is_exist(X, Y, x, y):
        print("No War")
    else:
        print("War")


main()

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


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

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

x.sort()
y.sort()
xmax = x[-1]
ymin = y[0]

if xmax<ymin:
    ans = "No War"
else: ans = "War"

print(ans)

Submission status: Accepted

Solution code:
_, _, X, Y = map(int, input().split())
x=list(map(int, input().split()))
y=list(map(int, 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:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007
sys.setrecursionlimit(1000000)

#A
def A():
    s = LI()
    s.sort(reverse = True)
    print(10*s[0]+s[1]+s[2])
    return

#B
def B():
    n,m,X,Y = LI()
    x = LI()
    y = LI()
    x = max(x)
    y = min(y)
    if x >= y:
        print("War")
    else:
        for z in range(x+1,y+1):
            if X < z <= Y:
                print("No War")
                quit()
        print("War")

    return

#C
def C():
    s = S()
    t = S()
    n = len(s)
    d = defaultdict(list)
    for i in range(n):
        d[s[i]].append(t[i])
    d2 = defaultdict(list)
    for i in range(n):
        d2[t[i]].append(s[i])
    for i in d.keys():
        k = d[i]
        k = list(set(d[i]))
        if len(k) > 1:
            print("No")
            quit()
    for i in d2.keys():
        k = d2[i]
        k = list(set(d2[i]))
        if len(k) > 1:
            print("No")
            quit()
    print("Yes")
#D
def D():
    n,m = LI()
    if m == 1:
        print(1)
        quit()
    d = defaultdict(int)
    i = 2
    a = m
    while i**2 <= m:
        if not a%i:
            while not a%i:
                a//=i
                d[i] += 1
        i += 1
    if a != 1:
        d[a] += 1
    fact = [1 for i in range(n+31)]
    for i in range(n+30):
        fact[i+1] = fact[i]*(i+1)%mod
    inv_fact = [None for i in range(n+31)]
    inv_fact[n+30] = pow(fact[n+30],mod-2,mod)
    for i in range(n+30)[::-1]:
        inv_fact[i] = inv_fact[i+1]*(i+1)%mod
    ans = 1
    for i in d.values():
        ans *= fact[i+n-1]*inv_fact[i]*inv_fact[n-1]%mod
        ans %= mod
    print(ans)
#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    B()

Submission status: Accepted

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

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()))
ok = False
for zi in range(-100,101):
  if x < zi <= y:
    if max(xi)<zi and min(yi)>=zi:
      ok = True
if ok:
  print("No War")
else:
  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()]
if X <= max(x_list) < min(y_list) <= Y:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
import numpy as np

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

min_x = np.min(x)
max_x = np.max(x)
min_y = np.min(y)
max_y = np.max(y)

if(X < Y): #ZはXより大きな整数であるため
    if((max_x < min_y) and (max_x < Y) and (min_y > X)):
        print("No War")
    else:
        print("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()))
for i in range(X+1,Y+1) :
  if  x < i and i <= y :
    print("No War")
    break
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()))
P=0
for i in range(X+1,Y+1) :
  if  x < i and i <= y :
    print("No War")
    break
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()))
P=0
for i in range(X+1,Y+1) :
  if X < i and i <=Y and x < i and i <= y :
    print("No War")
    break
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()))
P=0
for i in range(X+1,Y+1) :
  if X < i and i <=Y and x < i and i <= y :
    P+=1
if P==0 :
  print("War")
else :
  print("No War")

Submission status: Accepted

Solution code:
N, M, X, Y = [int(x) for x in input().split()]
xs = [int(x) for x in input().split()]
ys = [int(x) for x in input().split()]

x = max(X, max(xs))
y = min(Y, min(ys))
ans = x >= y

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

x.sort()
y.sort()

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

Submission status: Accepted

Solution code:
N,M,X,Y = [int(x) for x in input().split()]
x = [X]+[int(x) for x in input().split()]
y = [Y]+[int(x) for x in input().split()]
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_max = max(x)
y_min = min(y)


flg = True
if x_max < y_min:
  if X < Y - 1:
    if X < y_min:
      if x_max < Y: 
        print("No War")
        flg = False

if flg:
  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 Z in range(-100, 101):
    if X < Z <= Y and max(x) < Z and Z <= min(y):
        print('No War')
        sys.exit()
print('War')

Submission status: Accepted

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