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:
import math
import copy
import sys

# inputa = input().split()
# inputb = input().split()
# inputc = input().split()

# a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])

# inputb = input().split()
# inputbList = [int(n) for n in inputb]
#
# inputList=[]
# inputNumList = []
# for i in range(a):
#     inputNum = input().split()
#     inputNumList = [int(n) for n in inputNum]
#     inputList.append(inputNumList)

# inputList = [int(n) for n in inputList]

# b = [int(n) for n in inputb]
# c = [int(n) for n in inputc]

inputa = input().split()
inputaList = [int(n) for n in inputa]

inputb = input().split()
inputbList = [int(n) for n in inputb]

inputc = input().split()
inputcList = [int(n) for n in inputc]

inputbList.append(inputaList[2])
xmin = min(inputbList)
xmax = max(inputbList)

inputcList.append(inputaList[3])
ymin = min(inputcList)
ymax = max(inputcList)

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

Submission status: Accepted

Solution code:
n,m,x,y=input().split()
n,m,x,y=int(n),int(m),int(x),int(y)
x1=input().split()
x2=[]
for i in range(n):
    x2.append(int(x1[i]))
y1=input().split()
y2=[]
for i in range(m):
    y2.append(int(y1[i]))

s="War"
if y>x:
    for i in range(y-x):
        if x+i+1>max(x2) and min(y2)>=x+i+1:
            s="No War"

print(s)

Submission status: Accepted

Solution code:

i = lambda:map(int,input().split())
_,_,x,y = i()
print('No War' if max(sum([list(i()),[x]],[])) < min(sum([list(i()),[y]],[])) else 'War')

Submission status: Accepted

Solution code:

i = lambda:map(int,input().split())
_,_,x,y = i()
print('No War' if len(set(range(max(i())+1,min(i())+1)).intersection(set(range(x+1,y+1)))) > 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.append(X)
y.append(Y)

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

for j in range(X + 1,Y+1):
    hantei1 = 0
    hantei2 = 0
    for k in range(N):
        if x[k] >= j:
           hantei1 = 1
           break
    for l in range(M):
        if y[l] < j:
           hantei1 = 1
           break
    if hantei1 == 0 and hantei2 == 0:
        print("No War")
        hantei = 1
        break
  
if hantei == 0:
    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)
for i in range(-100,101):
    if X < i <= Y and x_max < i and y_min >= i:
        print("No War")
        exit()
print("War")

Submission status: Accepted

Solution code:
n,m,X,Y = map(int, input().split())
import numpy as np
x = np.array(list(map(int, input().split())))
y = np.array(list(map(int, input().split())))

for i in range(X+1,Y+1):
  if (x<i).all() and (y>=i).all():
    print("No War")
    break
else:
  print("War")

Submission status: Accepted

Solution code:
n,m,x,y = map(int,input().split())
xx = list(map(int,input().split()))
yy = list(map(int,input().split()))
for i in range(x+1,y+1):
  if max(xx) < i <=min(yy):
    print('No War')
    exit()
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())
xl = list(map(int, input().split()))
yl = list(map(int, input().split()))
mx = max(xl) + 1
my = min(yl)
for i in range(x + 1, y + 1):
    if mx <= i <= my:
        print("No War")
        exit()
print("War")

Submission status: Accepted

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

ans = 'No War' if max(max(xx), x) < min(min(yy), y) else 'War'
print(ans)

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().split())
xl=list(map(int,input().split()))
xl.append(x)
yl=list(map(int,input().split()))
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())

jpn = sorted(list(map(int, input().split())))
usa = sorted(list(map(int, input().split())))

a = list(range(jpn[-1]+1, usa[0]+1))

if not a:
    print('War')
    exit()

for i in a:
    if x < i <= y:
        print('No War')
        exit()

print('War')

Submission status: Accepted

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

x.append(xl)
y.append(yl)
x_mx=max(x)
y_mn=min(y)

res='War' 

if x_mx<y_mn:
	res='No War' 

print(res)

Submission status: Accepted

Solution code:
n,m,x,y = map(int,input().split())
xl = list(map(int,input().split()))
xl.append(x)
yl = list(map(int,input().split()))
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())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
a.append(x)
b.append(y)
if(min(b)>max(a)):
  print("No War")
else:
  print("War")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#https://atcoder.jp/contests/abc110/tasks/abc110_b

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.sort(reverse = True)
y.sort()

flag = 'War'
if x[0] < y[0]:
    zmin = x[0] + 1
    zmax = y[0]
    for i in range(zmin, zmax + 1):
        if X < i and i <= Y:
            flag = 'No War'
            break

print(flag)

Submission status: Accepted

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

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()))
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 = list(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"

print(z)

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()))
xeast = max(X)
ywest = min(Y)
if xeast < ywest and xeast < y and x < ywest:
  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()))
x1.append(x)
y1.append(y)

if max(x1) < min(y1):
    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()))
mini = max(x)
maxi = min(y)
al = [i for i in range(X+1,Y+1)]
ol = [i for i in range(mini+1,maxi+1)]
for i in ol:
    if i in al:
        print("No War")
        exit()
print("War")

Submission status: Accepted

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

lx.append(x)
ly.append(y)
if min(ly)-max(lx)>0:
    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(i) for i in input().split()]

p=max(x)
q=min(y)

Z=max(p,X)+1

if Z<=Y and Z<=q:
    print("No War")
else:
    print("War")

Submission status: Accepted

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

max_x = max(li_x)
min_y = min(li_y)

for i in range(x+1,y+1):
    if max_x < i <= min_y:
        print("No War")
        break
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:
import sys
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    [N, M, X, Y] = string_to_int(inputs[0])
    x = string_to_int(inputs[1])
    y = string_to_int(inputs[2])
    max_x = max(x)
    min_y = min(y)

    candidates = [x for x in range(max_x+1, min_y+1)]
    for c in candidates:
        if c > X and c <= Y:
            return "No War"
    return "War"


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(3))
    print(ret)

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

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

print(ans)

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

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

print(ans)

Submission status: Accepted

Solution code:
n,m,x,y = map(int, input().split())
xli = list(map(int, input().split()))
yli = list(map(int, input().split()))
xmax = max(xli)
ymin = min(yli)
for z in range(x+1, y+1):
    if xmax < z <= ymin:
        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()))

count = 0

x.sort()
y.sort()

# print(x)
# print(y)

for Z in range(200):
    if X < Z-100 and Z-100 <= Y:
        if x[N-1] < Z-100 and y[0] >= Z-100:
            count += 1
            # print(Z-100)


if count != 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,max(x))
min_Y = min(Y,min(y))

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

Submission status: Accepted

Solution code:
import numpy as np

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

if min(y_list) - max(x_list)>0:
  print("No War")
else:
  print("War")

Submission status: Accepted

Solution code:
n,m,x,y,*l=map(int,open(0).read().split());print((max(x,*l[:n])<min(y,*l[n:]))*"No "+"War")

Submission status: Accepted

Solution code:
n,m,x,y,*l=map(int,open(0).read().split())
print((max(l[:n]+[x])<min(l[n:]+[y]))*"No "+"War")

Submission status: Accepted

Solution code:


def main():

    tmp=list(map(int,input().split()))
    X = tmp[2]
    Y = tmp[3]
    xl = max(list(map(int,input().split())))
    yl = min(list(map(int,input().split())))

    for i in range(X+2,Y+1):
        if xl < i and i <= yl:
            print("No War")
            exit()

    print("War")
        
    
if __name__== "__main__":
    main()

Submission status: Accepted

Solution code:


def main():

    tmp=list(map(int,input().split()))
    X = tmp[2]
    Y = tmp[3]
    xl = list(map(int,input().split()))
    yl = list(map(int,input().split()))

    for i in range(X+2,Y+1):
        if max(xl) < i and i <= min(yl):
            print("No War")
            exit()

    print("War")
        
    
if __name__== "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC 110 , B
tmp = [int(el) for el in input().split(' ')]
n = tmp[0]
m = tmp[1]
x = tmp[2]
y = tmp[3]

X = [int(el) for el in input().split(' ')]
Y = [int(el) for el in input().split(' ')]

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

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 xList[-1] + 1 <= Y:
  print("No War");
else:
  print("War");

Submission status: Accepted

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

ans = 'War'
for i in range(X+1, Y+1):
    if (max(lst_x) < i and min(lst_y) >= i):
        ans = 'No War'
print(ans)

Submission status: Accepted

Solution code:
l = [int(i) for i in input().split(" ")]
n = l[0]
m = l[1]
x = l[2]
y = l[3]
z_set = set(range(x+1,y+1))
if len(z_set) == 0:
    print("War")
else:
    x_max = max([int(i) for i in input().split(" ")])
    y_min = min([int(i) for i in input().split(" ")])
    x_y_set = set(range(x_max+1,y_min+1))
    if len(x_y_set & z_set) == 0:
        print("War")
    else:
        print("No 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())))
for i in range(xx + 1, yy + 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()))

check = 0

for i in range(X+1, Y+1):
    tmp = 0
    for j in range(N):
        if x[j] < i:
            tmp += 1
    for j in range(M):
        if y[j] >= i:
            tmp +=1
    if tmp == N+M:
        check = 1
        break

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

xx = max(xs)
yy = min(ys)

ok = False
for z in range(x + 1, y + 1):
    if xx < z <= yy:
        ok = True

print("No War" if ok 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()

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

Submission status: Accepted

Solution code:
N,M,X,Y = (int(x) for x in input().split())
x_arr = sorted([int(x) for x in input().split()]+[X])
y_arr = sorted([int(x) for x in input().split()]+[Y])

if(x_arr[-1] < y_arr[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(x)
#print(y)

x_max=int(max(xs))
y_min=int(min(ys))

if x_max<y_min and y_min<y and y_min!=x:
    print("No War")

else:
    print("War")

Submission status: Accepted

Solution code:
words = lambda t : list(map(t, input().split()))
n,m,x,y = words(int)
xs = words(int)
ys = words(int)

x_max = max(xs)
y_min = min(ys)

if x_max < y_min and x_max < y and y_min > x :
    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()))

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
n, m, x, y = map(int, input().split())
l = [list(map(int, input().split())) for i in range(2)]
if min(l[1]) - max(l[0])> 0 and max(l[0]) < y and x < min(l[1]):
    print('No War')
else:
    print('War')

Submission status: Accepted

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

max_x = max(List_x)
min_y = min(List_y)
if max(X,max_x)+1 <= min(Y,min_y):
    print("No War")
else:
    print("War")

Submission status: Accepted

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

xa.sort()
ya.sort()

if xa[-1] < ya[0] and (x < xa[-1] + 1 <= y or x < ya[0] <= 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()))

for i in range(X+1, Y+1):
    flag1 = all([True if x < i else False for x in xs])
    flag2 = all(True if y >= i else False for y in ys)
    if flag1 and flag2:
        print("No War")
        exit()
print("War")

Submission status: Accepted

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

ans = 'War'
Z = []
for i in range(X + 1, Y + 1):
    Z.append(i)

delxLst = []
for i in range(len(Z)):
    for j in range(len(xLst)):
        if Z[i] <= xLst[j]:
            delxLst.append(i)
            break

delxLst.sort(reverse=True)
for i in range(len(delxLst)):
    del Z[delxLst[i]]

delyLst = []
for i in range(len(Z)):
    for j in range(len(yLst)):
        if Z[i] > yLst[j]:
            delyLst.append(i)
            break
delyLst.sort(reverse=True)
for i in range(len(delyLst)):
    del Z[delyLst[i]]

if len(Z) > 0:
    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
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a = LI()
    a.sort()
    a, b, c = a
    print(int(str(c)+str(b))+a)
    return

#B
def B():
    n, m, X, Y = LI()
    x = LI()
    y = LI()
    x.append(X)
    y.append(Y)
    x.sort()
    y.sort()
    print("No " * (x[-1] < y[0]) + "War")
    return

#C
def C():
    return

#D
def D():
    return

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

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split()) # 横に2個
Xs = list(map(int, input().split()))
Ys = list(map(int, input().split()))

Xs.sort()
Ys.sort()

if max(Xs[-1], X) < min(Ys[0], Y):
    ans = 'No War'
else:
    ans = 'War'

print(ans)

Submission status: Accepted

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

x_max = max(x_areas)
y_min = min(y_areas)

if x_max < y_min and x_max < Y and y_min > 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()))

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())
x = max(map(int, input().split()))
y = min(map(int, input().split()))
print('No War' if any([ X < z <= Y and x < z <= y for z in range(X+1, Y+1)]) 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()))

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

flag = 0
for z in range(xmax+1,ymin+1):
    if X < z and z <= Y:
        flag = 1
if flag == 0:
    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.sort()
y.sort()
ans = 'War'
for i in range(X+1, Y+1):
	flag = True
	for j in range(0, N):
		if i <= x[j]:
			flag = False
	for j in range(0, M):
		if y[j] < i:
			flag = False
	if flag:
		ans = 'No '+ans
		break
print(ans)

Submission status: Accepted

Solution code:
import sys
n,m,x,y = map(int,input().split())
x_arr = sorted(list(map(int,input().split())))
y_arr = sorted(list(map(int,input().split())))
for z in range(x+1,y+1,1):
  if x_arr[-1] < z and y_arr[0] >= z:
    print('No War')
    sys.exit()
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()))
if max(max(lstx),x)+2 <= min(min(lsty),y)+1:
  print("No War")
else:
  print("War")

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split())
e = list(map(int, input().split()))
f = list(map(int, input().split()))
e = sorted(e, reverse=True)
f.sort()
for i in range(e[0] + 1, f[0] + 1):
    if c < i <= d:
        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)
xs.sort()
ys.sort()
if xs[-1] >= ys[0]:
    print("War")
else:
    print("No 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.sort()
y_city.sort()
if y_city[0] - x_city[-1] > 0 and x < y_city[0] and x_city[-1] < y:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
import sys
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.sort()
y.sort()
if X < Y:
    num = 0
    for Z in range(X+1, Y+1):
        num += 1
        if x[-1] < Z and y[0] >= Z:
            print('No War')
            sys.exit()
    if num == Y-X:
        print('War')
else:
    print('War')

Submission status: Accepted

Solution code:
n, m, x, y = map(int, input().split())
xmax = max(list(map(int, input().split())))
ymin = min(list(map(int, input().split())))
if max(x, xmax) < min(y, ymin):
  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())) 

maxX=max(x)
minY=min(y)

if maxX<minY:
    if X<minY and minY<=Y:
        print("No War")
    else:
        print('War')
else:
    print('War')

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().split())
lix=list(map(int,input().split()))
liy=list(map(int,input().split()))
if min(y, min(liy)) <= max(x,max(lix)):
  print("War")
else:
  print("No 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())))
Z = y[0]

if Z>=Y:
    Z = Y

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

Submission status: Accepted

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

if max(l_x)>=min(l_y) or max(l_x)>=y or min(l_y)<=x:
    print("War")
else:
    print("No 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()]
f3 = False
for z in range(X+1, Y+1):
    f1 = True
    for i in range(N):
        if x[i] >= z:
            f1=False

    for i in range(M):
        if y[i] < z:
            f1=False

    if f1==True:
        print('No War')
        exit()

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()))
z = "War"

for i in range(a[2]+1,a[3]+1):
  if max(x)<i<=min(y):
    z = "No War"
else:
  print(z)

Submission status: Accepted

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

lineX.append(X)
lineY.append(Y)

if max(lineX) < min(lineY):
    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()))

xm = max(X)

ym = min(Y)


for z in range(x+1, y+1):
    if(z > xm and z <= ym):
        print("No War")
        sys.exit()


print("War")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
#ABC110 B

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

Submission status: Accepted

Solution code:
_, _, X, Y = list(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:
l = list(map(int,input().split()))
x = list(map(int,input().split()))
y = list(map(int,input().split()))
bool = False
for i in range(-100,101):
    if max(x) < i and min(y) >= i and l[2] < i and l[3] >= i:
        bool = True
        break
if bool == True:
    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 < Y and max(max(x), X) < min(y) and max(x) < min(min(y), Y):
  print("No War")
else:
  print("War")

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split())
e = list(map(int, input().split()))
f = list(map(int, input().split()))
e.sort()
f.sort()
for i in range(e[len(e)-1] + 1, f[0] + 1):
    if c < i <= d:
        print("No War")
        exit()
print("War")

Submission status: Accepted

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

xls = list(map(int,input().split()))
yls = list(map(int,input().split()))

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

Submission status: Accepted

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

Z = np.linspace(X + 1, Y - 1, Y - X - 1)

for i in Z:
    if max(sorted(x)) < i and i <= min(sorted(y)):
        print("No War")
        exit()
print("War")

"""
3 2 10 20
8 15 13
16 22
"""