Problem:


Score : 200 points

Problem Statement

Our world is one-dimensional, and ruled by two empires called Empire A and Empire B.

The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.

One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.

If there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.

X < Z \leq Y

x_1, x_2, ..., x_N < Z

y_1, y_2, ..., y_M \geq Z

Determine if war will break out.

Constraints

All values in input are integers.

1 \leq N, M \leq 100

-100 \leq X < Y \leq 100

-100 \leq x_i, y_i \leq 100

x_1, x_2, ..., x_N \neq X

x_i are all different.

y_1, y_2, ..., y_M \neq Y

y_i are all different.

Input

Input is given from Standard Input in the following format:

N M X Y
x_1 x_2 ... x_N
y_1 y_2 ... y_M

Output

If war will break out, print War; otherwise, print No War.

Sample Input 1

3 2 10 20
8 15 13
16 22

Sample Output 1

No War

The choice Z = 16 satisfies all of the three conditions as follows, thus they will come to an agreement.

X = 10 < 16 \leq 20 = Y

8, 15, 13 < 16

16, 22 \geq 16

Sample Input 2

4 2 -48 -1
-20 -35 -91 -23
-22 66

Sample Output 2

War

Sample Input 3

5 3 6 8
-10 3 1 5 -100
100 6 14

Sample Output 3

War



Sample input:
3 2 10 20
8 15 13
16 22


Sample output:
No War

Submission status: Accepted

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

max_l_x = max(l_x)
min_l_y = min(l_y)

b_x = x if max_l_x < x else max_l_x
b_y = min_l_y if min_l_y < y else y

if b_x < b_y:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:

qq,qqq,aa,bb=map(int,input().split())
a=sorted([int(x) for x in input().split()])
b=sorted([int(x) for x in input().split()])
if(max(aa,a[-1])<min(bb,b[0])):
    print("No ",end="")
print("War")

Submission status: Accepted

Solution code:
import sys


def main():
    n, m, x, y = map(int, input().split())
    xs = list(map(int, input().split()))
    ys = list(map(int, input().split()))

    xs.sort()
    ys.sort()
    a = xs[-1]
    b = ys[0]

    if a <= b:
        for i in range(b-a+1):
            z = a + i
            if a < z and z <= b and x < z and z <= y:
                print("No War")
                sys.exit(0)
        print("War")
    else:
        print("War")


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = 'War'
for z in range(x + 1, y + 1):
  if x < z <= y:
    if all([i < z for i in x_l]) and all([i >= z for i in y_l]):
      ans = 'No War'
      break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
N, M, X, Y = [int(str) for str in input().strip().split()]
xs = [int(str) for str in input().strip().split()]
ys = [int(str) for str in input().strip().split()]

ans = False

for z in range(max(xs) + 1, min(ys) + 1):
    if X < z <= Y:
        ans = True

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

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

print("War")

Submission status: Accepted

Solution code:
#abc110 b
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)
flag=False
for i in range(X+1,Y+1):
    if x_max<i<=y_min:
        flag=True
        break
if flag:
    print("No War")
else:
    print("War")

Submission status: Accepted

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

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

x_list.sort()
y_list.sort()

x_max = x_list[-1]
y_min = y_list[0]

print( "No War" if  (y_min - x_max) > 0 else "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()]

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

print('No War') if 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()))
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:
import sys
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]+1,y[0]+1):
    if X<i and Y>=i:
        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(' ')))
if max(x) < min(y) and min(y)> X and max(x) <Y:
    print('No War')
else:
    print('War')

Submission status: Accepted

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


for z in range (-150, 150):
    f = True
    if X >= z:
        f = False
    if Y < z:
        f = False
    
    for a in A:
        if a >= z:
            f = False
    
    for b in B:
        if b < z:
            f = False
    
    if f:
        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()))
max_x = max(x)
min_y = min(y)
flag = False
for Z in range(X + 1, Y + 1):
    if max_x < Z and min_y >= Z:
        flag = True
print('No War' if flag 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 max(x)<min(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()))

for z in range(x + 1, y + 1):
    if all(i < z for i in a) and all(i >= z for i in b):
        print('No War')
        exit()
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()))
for i in range(X+1,Y):
  if max(xl) < i and min(yl) >= 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()))
x.append(X)
y.append(Y)
if max(x)>=min(y):
  print('War')
else:
  print('No 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()))

xmax = max(xlst)
ymin = min(ylst)
cand = []
for i in range(xmax+1, ymin+1):
    cand.append(i)
    
warflag = True
for c in cand:
    if X < c <= Y:
        warflag = False
if warflag:
    print('War')
else:
    print('No War')

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
Xs = list(map(int, input().split())) + [X]
Ys = list(map(int, input().split())) + [Y]

if min(Ys) - max(Xs) >= 1:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    N, M, X, Y = map(int, input().split())
    max_x = max(max(map(int, input().split())), X)
    min_y = min(min(map(int, input().split())), Y)

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#ABC110

n,m,x,y = list(map(int,input().split()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
l = []
if max(a)<= min(b):
    l = [i for i in range(max(a)+1,min(b)+1)]
    #print(l)
for i in l:
    if x < i <= 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()))


flag = True

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

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

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

Submission status: Accepted

Solution code:
import math
import string


def readints():
    return list(map(int, input().split()))


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


N, M, X, Y = map(int, input().split())
x = readints()
y = readints()
# print(x)
# print(y)


def func(z):
    if (X < z and z <= Y):
        pass
    else:
        return False
    for i in range(N):
        if x[i] < z:
            pass
        else:
            return False
    for i in range(M):
        if y[i] >= z:
            pass
        else:
            return False
    return True


for i in range(-10000, 10000):
    if func(i) == True:
        print('No War')
        exit()
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()))

flag = False
#for z in range(-100, 101):
for z in range(X + 1, Y + 1):
    count_x = 0
    count_y = 0
    for i in x:
        if i < z:
            count_x += 1
    for i in y:
        if i >= z:
            count_y += 1
    #print(count_x, count_y)
    if count_x == n and count_y == m:
        flag = True
        #print(z)
if flag:
    print("No War")
else:
    print("War")

"""
count_x = 0
count_y = 0
ans = 0
for Z in range(-100, 101):
    #Z = 16
    if X <= Z <= Y:
        for i in range(n):
            if x[i] < Z:
                count_x += 1
        for j in range(m):
            if y[j] >= Z:
                count_y += 1
        if count_x == n and count_y == m:
            ans = 1

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

Submission status: Accepted

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

if mx_x < mn_y:
    print('No War')
    
else:
    print('War')

Submission status: Accepted

Solution code:
a = list(map(int, input().split(' ')))
s, t = a[2], a[3]
mi = max(map(int, input().split(' ')))
ma = min(map(int, input().split(' ')))
if not mi < ma:
  print('War')
  exit()
for i in range(mi+1, ma+1):
  if s < i <= t:
    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()))
z='No War' if max(x)<min(y) and X<min(y) and min(y)<=Y else '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()))
x.append(X)
y.append(Y)
x.sort()
y.sort()

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

Submission status: Accepted

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

max_x=max(x)
min_y=min(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())
xn = list(map(int, input().split()))
ym = list(map(int, input().split()))

for z in range(-100, 101):
    war = False
    if x < z and z <= y:
        for i in range(n):
            for j in range(m):
                if xn[i] >= z or ym[j] < z:
                    war = True
        if war == False:
            print("No War")
            exit()
print("War")

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().split())
tmpx=x
tmpy=y
li_x=list(map(int,input().split()))
li_y=list(map(int,input().split()))
for i in range(n):
  tmpx=max(tmpx,li_x[i])
for j in range(m):
  tmpy=min(tmpy,li_y[j])
if tmpx+1<=tmpy:
  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()]

c=0
for i in range(X+1,Y+1):
  c =0
  if (i >X and i <=Y) :
    c += 1
  if max(x) < i :
    c += 1
  if min(y) >= i :
    c += 1
  
  if c == 3:
   
    print("No War")
    exit()
  else:
    continue
    
    
print("War")

Submission status: Accepted

Solution code:
N_x, M_y, X, Y = map(int, input().split())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))

judge = 'War'
border_x = max(X, max(xs))
border_y = min(Y, min(ys))

if (border_x < border_y):
    judge = 'No War'

print(judge)

Submission status: Accepted

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

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

Submission status: Accepted

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

L = []
for i in range(x+1,y+1):
    falg = True
    if max(x_L) < i and min(y_L) >= i:
        print("No War")
        exit()

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

max_x = max(x_li)
min_y = min(y_li)
for i in range(X + 1, Y + 1) :
    if max_x < i and min_y >= i :
        print("No War")
        exit()
print("War")

Submission status: Accepted

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

xc = list(map(int,input().split()))
xc.sort()
yc = list(map(int,input().split()))
yc.sort()

if xc[-1]+1 <= yc[0] and x < xc[-1]+1 and y >= xc[-1]+1:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
n,m,X,Y = map(int,input().split())
x = max(list(map(int,input().split())))
y = min(list(map(int,input().split())))
ok = False
for z in range(X+1,Y+1):
        if x < z and y >= z:
            ok = True
            break
if ok :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()))
s=max(X)
t=min(Y)
ans='War'
for i in range(x+1,y+1):
    if i>s:
        if i<=t:
            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()))
a = 0

for i in range(x+1,y+1):
  if i > max(X):
    if i <= min(Y):
      a = 1
      break
  else:
    pass
  
if a == 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()))

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

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

print('War')

Submission status: Accepted

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n,m,x,y=INTM()
    xs=LIST()
    xs.append(x)
    ys=LIST()
    ys.append(y)
    #print(xs,ys)
    if max(xs)>=min(ys):
        print('War')
    else:
        print('No War')
    
    
if __name__ == '__main__':
    do()

Submission status: Accepted

Solution code:
N,M,X,Y=map(int,input().split())
x=map(int,input().split())
y=map(int,input().split())
xmax=max(x)
ymin=min(y)
print( "No War" if (xmax<ymin and xmax<Y and X<ymin ) 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)
x.sort()
y.sort()
if x[-1] < y[0]:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
n, m, a, b = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

if a < b and max(A) < b and min(B) > a and max(A) < min(B):
    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()))
ans="War"
z=max(x_list)+1
if z>x and z<=y and z<=min(y_list):
    ans="No War"
print(ans)

Submission status: Accepted

Solution code:
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

N, M, X, Y = na()
x = na()
y = na()
miny = min(y)
maxx = max(x)
flag = False
for i in range(X + 1, Y + 1):
    if maxx < i and miny >= i:
        flag = True

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

Submission status: Accepted

Solution code:
n, m, x, y = list(map(int, input().split()))
xv = list(map(int, input().split()))
yv = list(map(int, input().split()))
xv.append(x)
yv.append(y)
if x < y and max(xv) < min(yv):
  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()))
ans = "War"
for z in range(max(X, Y)+1):
    if X < z <= Y and len([i for i in x if i < z]) == len(x) and len([i for i in y if i >= z]) == len(y):
        ans = "No War"
        break
print(ans)

Submission status: Accepted

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

if min(y_)>max(x_):
            print('No War')
else:
            print('War')

Submission status: Accepted

Solution code:
f1=-1;f2=-1;z1=0;z2=0
N,M,X,Y=map(int,input().split())
x=sorted(list(map(int,input().split())))
y=sorted(list(map(int,input().split())))

z1=x[-1]+1
z2=y[0]
if z1<=z2:
  if X<=x[-1] and Y>=y[0]:
    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()))
x=sorted(x)
y=sorted(y)
flag=0 
for Z in range(X+1,Y+1):
    if x[N-1]<Z and y[0]>=Z:
        flag=1
print('No War' if flag==1 else 'War')

Submission status: Accepted

Solution code:
class Solution:
    def solve(self, N: int, M: int, X: int, Y: int, x, y) -> int:

        x_ub = max(x + [X])
        y_lb = min(y + [Y])

        if x_ub < y_lb:
            return "No War"
        else:
            return "War"


if __name__ == '__main__':

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

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

    # solve
    solution = Solution()
    print(solution.solve(N, M, X, Y, x, y))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#110_B
N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
flg=True
if max(x)>=min(y) or X>=Y:
    flg=False
elif min(y)<=X or Y<=max(x):
    flg=False
print('No War' if flg 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()))

flag = False
cnt = 0
Z = [i for i in range(X + 1, Y + 1)]
for z in Z:
    if max(x) < z and z <= min(y):
        flag = True
        break

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

Submission status: Accepted

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

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

ans = False
for i in range(X+1, Y+1):
    if i > x_max and i <= y_min:
        ans = True
        break

if ans:
    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,1):
    if max(x)<i and i<=min(y):
        print("No War")
        exit()
print("War")

Submission status: Accepted

Solution code:
num_s, *D,  = [list(map(int, s.split())) for s in open(0)] 
flag = 0
x, y = D[0], D[1]

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

if max_x > min_y:
    flag += 1
else:
    for i in range(max_x  + 1, min_y + 1):
        if i > num_s[2] and i <= num_s[3]:
            break 
    else:
        flag += 1
if flag:
    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()))+[X]
y=list(map(int,input().split()))+[Y]
print("No War" if max(x)<min(y) else "War")

Submission status: Accepted

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

ans=False

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

Submission status: Accepted

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

Submission status: Accepted

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


if max(max(xl),x) < min(min(y1),y):
    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())
ans = [i for i in range(X+1, Y+1) if max(x) < i and min(y) >= i]
if ans:
    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())
limit1 = min(y)
limit2 = max(x)
if X< limit1 <= Y and limit2 < limit1:
    print("No War")
else:
    print("War")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N, M, X, Y = map(int,input().split())
x = [int(x) for x in input().split()]
y = [int(y) for y in input().split()]
x.append(X)
y.append(Y)
x_max = max(x)
y_min = min(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 = 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 <= min(Y_list):
        print('No War')
        exit()
print('War')

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
l1 = [i for i in range(X+1, Y+1)]
s1 = set(l1)
X_list = list(map(int, input().split()))
Y_list = list(map(int, input().split()))
X_max = max(X_list)
Y_min = min(Y_list)
if X_max < Y_min:
    l2 = [i for i in range(X_max+1, Y_min+1)]
    s2 = set(l2)
    if s1 & s2:
        print('No War')
    else:
        print('War')
else:
    print('War')

Submission status: Accepted

Solution code:
import sys
n, m, x, y = map(int, input().split())
x_city = list(map(int, input().split()))
y_city = list(map(int, input().split()))

for z in range(x+1, y+1):
    if max(x_city) < z <= min(y_city) :
        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()))
mx=max(x)
my=min(y)
if mx>my or X>Y:
    print("War")
    exit(0)
for z in range(mx+1,my+1):
    if X<z<=Y:
        print("No War")
        exit(0)
print("War")

Submission status: Accepted

Solution code:
def is_collided(x: int, y: int, xn: list, ym: list) -> bool:
    xn_max = max(xn)
    ym_min = min(ym)

    if xn_max >= ym_min:
        return True
    # xn_max ~ ym_minとx ~ yが重なっていなければ衝突する
    return xn_max >= y or ym_min <= x

def main():
    line1 = list( map(lambda x:int(x), input().split(' ')) )
    line2 = list( map(lambda x:int(x), input().split(' ')) )
    line3 = list( map(lambda x:int(x), input().split(' ')) )
    print("War") if is_collided(line1[2], line1[3], line2, line3) else  print("No War")

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N, M, X, Y = map(int, input().split())
    XN = list(map(int, input().split()))
    YM = list(map(int, input().split()))
    result = 'War'

    for z in range(X + 1, Y + 1):
        if X < z <= Y and max(XN) < z <= min(YM):
            result = 'No War'
    print(result)


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()))
print(("","No ")[max(max(x),X)<min(min(y),Y)]+"War")

Submission status: Accepted

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

Submission status: Accepted

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

for Z in range(max(x)+1, min(y)+1):
    if Z in range(X+1, 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()))

max_x = (max(x) + 1) 

ok = 0
dame = 0

for i in y:
    if max_x <= i:
        ok = ok + 1
    else:
        dame = dame + 1

if dame != 0:
    print("War")
elif (X < max_x <= Y) and dame == 0:
    print("No War")
else:
    print("War")

Submission status: Accepted

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

fl = True
for i in range(N):
    if x[i] < Z and (X<Z<=Y):
        continue
    else:
        fl = False
print('No War') if fl else print('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()))

xn.append(x)
ym.append(y)

xn.sort()
ym.sort()

if xn[-1] >= ym[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.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())

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

for z in range(x + 1, y + 1):
  if max(xl) < z and min(yl) >= z:
    print("No War")
    break
else:
  print("War")

Submission status: Accepted

Solution code:
m,n,X,Y=map(int,input().split())
*x,=map(int,input().split())
*y,=map(int,input().split())
for z in range(X+1,Y+1):
	if z <= min(y) and max(x) < z:
		print('No War')
		exit(0)
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()))
an = 0
for i in range(x+1,y+1):
    if max(xi) < i <= min(yi):
        an+=1
    
if an > 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 = sorted(x)
y = sorted(y)

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

Submission status: Accepted

Solution code:
n,m,x,y = (int(x) for x in input().split())
xl = list(int(x) for x in input().split())
yl = list(int(y) for y in input().split())
xm = max(xl)
ym = min(yl)
if(max(x,xm) < min(y,ym)):
  print("No War")
else:
  print("War")