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 = [int(i) for i in input().split()]
xs = [int(i) for i in input().split()]
ys = [int(i) for i in input().split()]
if max(xs) < min(ys):
    if x < min(ys) <= y:
        print("No War")
    else:
        print("War")
else:
    print('War')

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    n, m, x, y = list(map(int, input().rstrip('\n').split()))
    mx = max(list(map(int, input().rstrip('\n').split())))
    my = min(list(map(int, input().rstrip('\n').split())))
    for i in range(x + 1, y + 1):
        if mx < i <= my:
            print("No War")
            exit()
    print("War")


if __name__ == '__main__':
    slove()

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

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_min, y_min, x_max, y_max = min(x), min(y), max(x), max(y)

if x_max >= y_min and y_max >= x_min:
    print("War")
else:
    print("No War")

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

    z_min = max(x) + 1
    z_max = min(y)
    if z_min <= z_max:
        if z_max <= X or Y < z_min:
            print("War")
        else:
            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()))
ans ='War'
for i in range(X+1, Y+1):
  if max(x) < i and min(y) >= i:
    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()))
ans = "War"

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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):
    Flag = True
    for i in range(N):
        if x[i] >= z:
            Flag = False
            break
    for i in range(M):
        if y[i] < z or not(Flag):
            Flag = False
            break
    if Flag:
        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)
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()))
if max(xs + [x]) < min(ys + [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)
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()))
if max(x)<min(y) and max(x)<Y and 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()))
if max(max(X),x)<min(min(Y),y):
    print('No War')
else:
    print('War')

Submission status: Accepted

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

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

p_x=[int(j) for j in input().split()]
p_y=[int(i) for i in input().split()]

max_x=max(p_x)
Z=min(p_y)

if max_x<Z and (X<Z and Z<=Y):
    print('No War')
else:
    print('War')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
_, _, X, Y = map(int, input().split())
maxx = max(list(map(int, input().split())))
miny = min(list(map(int, input().split())))
flag = False
for i in range(X+1, Y+1):
    if maxx < i <= miny:
        flag = True
print('No War' if flag == True else 'War')

Submission status: Accepted

Solution code:
n,m,X,Y=map(int,input().split())
xn=list(map(int,input().split()))
ym=list(map(int,input().split()))
if max(xn)<min(ym) and max(xn)<Y and X<min(ym):
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
N,M,X,Y=[int(s) for s in input().split()]
lsx=[int(s) for s in input().split()]
lsy=[int(s) for s in input().split()]
lsx.append(X)
lsy.append(Y)
x=max(lsx)
y=min(lsy)
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 = sorted(x)[::-1]
y = sorted(y)

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

Submission status: Accepted

Solution code:
N,M,X,Y = map(int, raw_input().split())
X_list = map(int,raw_input().split())
Y_list = map(int,raw_input().split())
X_list_max = max(X_list)
Y_list_min = min(Y_list)

Z_list = []

for i in range(X+1,Y+1):
    if i > X_list_max:
        Z_list.append(i)
ans = "War"

for i in Z_list:
    if i <= Y_list_min:
        ans = "No War"
        break

print ans

Submission status: Accepted

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

l = max(x)
r = min(y)
flag = False
for z in range(X+1,Y+1):
    if l<z and z<=r:
        flag = True
        break
print('No War' if flag else 'War')

Submission status: Accepted

Solution code:
"""#################################################################
【ABC110】
B_1_Dimensional_Worlds_Tale
#################################################################"""

#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

N, M, X, Y = ISI()
x = ILI()
y = ILI()
good = False
for i in range(X+1, Y+1):
    if max(x) < i and min(y) >= i:
        good = True
        break
if good == 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()))

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, m, x, y = map(int, input().split())
x_list = [int(i) for i in input().split()]+[x]
y_list = [int(i) for i in input().split()]+[y]
if max(x_list) < min(y_list):
    print("No War")
else:
    print("War")

Submission status: Accepted

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

MAX_X = max(x)
MIN_Y = min(y)
for num in range(X + 1, Y + 1):
    if num > MAX_X and num <= MIN_Y:
        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()))
ans = 'War'
for i in range(x+1,y+1):
    if i <= max(lx):
        pass
    else:
        if i <= min(ly):
            ans = 'No War'
            print(ans)
            break
        else:
            pass
if ans == 'War':
    print(ans)

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline

def main():
    N,M,X,Y = map(int, input().split())
    z = [i for i in range(X+1,Y+1)]
    x = list(map(int, input().split()))
    y = list(map(int, input().split()))
    x.sort()
    y.sort()
    b = False
    for i in z:
        if x[-1] < i and i <= y[0]:
            b = True        
    if b:
        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()))
X.append(x)
Y.append(y)
print('No War'if max(X)<min(Y) else'War')

Submission status: Accepted

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

ans = "War"

if maxNum < minNum:
    for i in range(maxNum+1, minNum+1):
        if X < i and i <= Y:
            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()))
s=max(x)
t=min(y)
if s<X and X+1<=Y and Y<t:
  print("No War")
elif X<s and s+1<=t and t<Y:
  print("No War")
elif s<X and X+1<=t and t<Y:
  print("No War")
elif X<s and s+1<=Y and Y<t:
  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()))
Z = [i for i in range(X + 1, Y + 1)]

for i in Z:
    if max(x) < i <= min(y):
        print('No War')
        exit()
    else:
        continue
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.append(X)
y.append(Y)
x_max =	max(x)
y_min =	min(y)

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

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=[int(_) for _ in input().split()]
y=[int(_) for _ in input().split()]
x.sort()
y.sort()
if x[-1]<y[0] and x[-1]>X and y[0]<=Y:
    print('No War')
else:
    print('War')

Submission status: Accepted

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

    if max(x) < min(y):
        if min(y) <= X or max(x) >= Y:
            print("War")
        else:
            print("No War")
    else:
        print("War")

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n,m,x,y = map(int,input().split())
li1 = list(map(int,input().split()))
li2 = list(map(int,input().split()))
flag = False
for z in range(x+1,y+1):
    if all([i < z for i in li1]) and all([i >= z for i in li2]):
        flag = True
        #print(z)
        break
        
if flag == True:       
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, m, x, y = na()
xxx = na()
yyy = na()
ans = "War"
for z in range(x+1, y+1):
    if max(xxx) < z <= min(yyy):
        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()))

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n, m, x, y = na()
xs = na()
ys = na()

zmin = max(xs) + 1
zmax = min(ys)
if zmin <= zmax and x < zmin and zmax <= y: 
    print("No War")
else:
    print("War")

Submission status: Accepted

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

Flag = False
for z in range(X+1, Y+1):
    if max(x) < z and min(y) >= 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_max = max(list(map(int, input().split()))+[x])
y_min = min(list(map(int, input().split()))+[y])

if x_max < y_min:
  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)<min(y) and X<Y and X<min(y) and Y>max(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()))
x += [X]
y += [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:
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(-100, 101):
    if X < z and z <= Y and x[N - 1] < z and z <= y[0]:
        print("No War")
        exit()
print("War")

Submission status: Accepted

Solution code:
N,M,X,Y= [int(i) for i in input().split()]
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
A.append(X)
B.append(Y)
A = sorted(A)
B = sorted(B)
print("War"if A[N] >= B[0] else "No War")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    n, m, x, y = list(map(int, input().rstrip('\n').split()))
    X = list(map(int, input().rstrip('\n').split()))
    Y = list(map(int, input().rstrip('\n').split()))
    mx = max(X)
    my = min(Y)
    for z in range(x + 1, y + 1):
        if mx < z <= my:
            print("No War")
            exit()
    print("War")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

z = list(range(max(x)+1, min(y)+1))
if len(list(filter(lambda x: X < x <= Y, z))) == 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()))
if max(max(x),X) < min(min(y),Y):
  print("No War")
else:
  print("War")

Submission status: Accepted

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

if max(max(x), X) < min(min(y), Y):
  print ("No War")
else:
  print ("War")

Submission status: Accepted

Solution code:
#B - 1 Dimensional World's Tale(ABC110)
N,M,X,Y=map(int, input().split())
x=list(map(int, input().split()))
y=list(map(int, input().split()))
if max(X,max(x))<min(Y,min(y)):
    print("No War")
else:
    print("War")

Submission status: Accepted

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

if Y-X>=1:
    Z=range(X+1,Y+1)
    for z in Z:
        if max(x)<z and min(y)>=z:
            print("No War")
            exit()
print("War")

Submission status: Accepted

Solution code:
n, m, x0, y0 = 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:
    if x0 < y_min and x_max < y0:
        print("No 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()))
List=[]
for i in range(X+1,Y+1):
  num=0
  for j in range(n):
    if i>x[j]:
      pass
    else:
      num+=1  
  for k in range(m):
    if i<=y[k]:
      pass
    else:
      num+=1
  List.append(num)
if 0 in List:
  print('No War')
else:
  print('War')

Submission status: Accepted

Solution code:
def test():
    n,m,x,y = map(int,input().split())
    a = list(map(int,input().split()))
    b = list(map(int,input().split()))
    flag = 0
    for i in range(x+1,y+1):
        c = i
        if all(k<c for k in a) and all(c<=m for m in b):
            flag = 1
            break

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


if __name__ == "__main__":
    test()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

a1.sort()
a2.sort()

left = a1[-1]
right = a2[0]

flag = False
for i in range(x+1,y):
    if i > left and i <= right:
        flag = True

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

Submission status: Accepted

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

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

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

    for i in range(X+1, Y):
        if max_x < i and min_y >= i:
            print('No War')
            exit()

    print('War')

main()

Submission status: Accepted

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

xs.sort()
ys.sort()
flag=0
if xs[-1]<y:
  z=xs[-1]+1
  if z==x or z==y:
    pass
  elif ys[0]>=z:
      print('No War')
      flag=1
if flag==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()))
print("No "*(max(X,max(x))<min(Y,min(y)))+"War")

Submission status: Accepted

Solution code:
def main():
    N, M, X, Y = map(int, input().split())
    A = [int(x) for x in input().split()]
    B = [int(y) for y in input().split()]
    for Z in range(X+1, Y+1):
        isFound = True
        for i in range(N):
            if A[i] >= Z:
                isFound = False
                break
        if isFound:
            for j in range(M):
                if B[j] < Z:
                    isFound = False
                    break
        if isFound:
            return "No War"
    return "War"

if __name__ == '__main__':
    print(main())

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)

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

def check():
    for z in range(x+1, y+1):
        if max(a)<z and min(b)>=z:
            print("No War")
            return
    print("War")
    return

check()

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

xs2 = sorted(xs)
ys2 = sorted(ys)
for i in range(x+1, y+1):
	if xs2[-1] < i <= ys2[0]:
		print("No War")
		quit()
print("War")

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

z = min(y)
if z <= max(x):
    print("War")
else:
    if X < z <= Y:
        print("No War")
    else:
        print("War")

Submission status: Accepted

Solution code:
n,m,x,y = map(int,input().split())
boundaryX = max(x,max(list(map(int,input().split()))))
boundaryY = min(y,min(list(map(int,input().split()))))
if boundaryY - boundaryX >= 1:
    print("No War")
else:
    print("War")

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

flag =False
d = x+1
while d <= y:
    if max(xs) < d and d <= min(ys):
        flag = True
        break
    d = d + 1

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

Submission status: Accepted

Solution code:
import math
import sys
import queue
from collections import Counter
from itertools import accumulate
from fractions import gcd
from functools import reduce


def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

sys.setrecursionlimit(10000)

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

if __name__ == "__main__":
    N, M, X, Y = map(int, sys.stdin.readline().split())
    x = list(map(int, sys.stdin.readline().split()))
    y = list(map(int, sys.stdin.readline().split()))
    x.append(X)
    y.append(Y)
    if max(x) >= min(y):
        print("War")
    else:
        print("No 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()))

flag = True

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

if Y - X < 2:
    flag = False

if y[0] <= x[-1] or (y[0] <= X or x[-1] >= Y):
    flag = False


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

Submission status: Accepted

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

if max(xN) < min(yM):
  print('No War')
else:
  print('War')

Submission status: Accepted

Solution code:
N,M,X,Y = map(int,input().split())
ans = 0
x = list(map(int,input().split()))
y = list(map(int,input().split()))
for i in range(X+1,Y):
  k = i
  if i>max(x):
    if i<=min(y):
      ans += 1
      break
if ans == 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()))

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

xs.sort()
ys.sort()

#print(n, m, x, y)
#print(xs)
#print(ys)

if(xs[-1] < x):
  xs[-1] = x
if(y < ys[0]):
  ys[0] = y

z = ys[0]
if(z <= xs[-1]):
  print("War")
elif(x < z and z <= y):
  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.sort()
b.sort()

for i in range(x+1,y+1):
    if a[n-1]<i<=b[0]:
        print('No War')
        break
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()))
lix.append(x)
liy.append(y)
lix.sort()
liy.sort()
if lix[n] < liy[0]:
  print("No 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()))
lix.append(x)
liy.append(y)
if max(lix) < min(liy):
  print("No War")
else:
  print("War")

Submission status: Accepted

Solution code:
def solve():
    n, m, x, y = map(int, input().split())
    xs = list(map(int, input().split()))
    xs.append(x)
    ys = list(map(int, input().split()))
    ys.append(y)
    return "War" if max(xs) >= min(ys) else "No War"


if __name__ == "__main__":
    print(solve())

Submission status: Accepted

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

ret = 'No War'
if X < Y:
    limit_x = sorted(xx)[-1]
    limit_y = sorted(yy)[0]
    if  limit_x >= limit_y or limit_x >= Y or limit_y<= X: 
        ret='War'
else:
    limit_x = sorted(xx)[0]
    limit_y = sorted(yy)[-1]
    if limit_x <= limit_y or limit_x <= Y or limit_y >= X:
        ret='War'

print(ret)

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",end=" ")
print("War")

Submission status: Accepted

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

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

Submission status: Accepted

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

xl = list(map(int,input().split()))
yl = list(map(int,input().split()))

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

Submission status: Accepted

Solution code:

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

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

print('War')

Submission status: Accepted

Solution code:
n, m, x, y = map(int, input().split())
nli = list(map(int, input().split()))
mli = list(map(int, input().split()))
nli.append(x)
mli.append(y)
if max(nli) >= min(mli):
    print('War')
else:
    print('No 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_max=sorted(x)[-1]
y_min=sorted(y)[0]
for z in range(X+1,Y+1):
  if x_max < z <= y_min:
    print('No War')
    exit()
print('War')