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:
def main():
    data = list(map(int, input().split()))
    Xn = data[0]
    Yn = data[1]
    X = data[2]
    Y = data[3]

    Xs = list(map(int, input().split()))
    Ys = list(map(int, input().split()))

    mergin = list(range(X, Y))
    flag = False
    if not mergin:
        mergin.append(0)
        flag = True
    x_line = min(mergin)
    y_line = max(mergin)

    max_x = max(Xs)
    min_y = min(Ys)

    if (max_x < min_y):
        if ((max_x + min_y) // 2 in mergin):
            if flag:
                print('War')
            else:
                print('No War')
        else:
            if flag:
                print('No War')
            else:
                print('War')
    else:
        if flag:
            print('No War')
        else:
            print('War')

if __name__ == "__main__":
    main()

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

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

a.sort()
b.sort()

if a[n]<b[0]:
  flag="No War"
else:
  flag="War"

print(flag)

Submission status: Accepted

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

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

for z in range(-100, 101):
    if X < z and z <= Y and max(x) < z and z <= min(y):
        print("No War")
        exit(0)
print("War")

Submission status: Accepted

Solution code:
def main():
    N, M, X, Y = (int(i) for i in input().split())
    x = sorted([int(i) for i in input().split()])
    y = sorted([int(i) for i in input().split()])
    if (x[-1] > y[0]):
        return 'War'
    else:
        for i in range(x[-1] + 1, y[0] + 1, 1):
            if i > X and i <= Y:
                return 'No War'
        return 'War'


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

Submission status: Accepted

Solution code:
ai = lambda: list(map(int, input().split()))
ai_ = lambda: [int(x) - 1 for x in input().split()]

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

Submission status: Accepted

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

z = min(min(xlis),min(ylis),x,y)
while (z <= max(max(xlis),max(ylis),x,y)):
    if x < z <= y and max(xlis) < z and z <= min(ylis):
        print('No War')
        exit()
    z +=1

print('War')

Submission status: Accepted

Solution code:
n, m, x, y = map(int, input().split())
l_x = [int(_) for _ in input().split()]
l_y = [int(_) for _ in input().split()]
max_x = max(l_x)
min_y = min(l_y)
if max_x < min_y:
    l_ans = set([i for i in range(max_x+1, min_y+1)])
    l_ans2 = set([i for i in range(x+1, y+1)])
    if l_ans & l_ans2:
        print("No War")
    else:
        print("War")
else:
    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()))

x=max(X)
y=min(Y)

if x<y and A[2]<A[3] and A[2]<y and x<A[3]:
    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 = 1

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

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split(' '))
max_x = max(map(int, input().split(' ')))
min_y = min(map(int, input().split(' ')))

if max_x < min_y:
    cand = [max_x+i+1 for i in range(min_y - max_x)]
    is_war = True
    for i in cand:
        if X < i <= Y:
            print('No War')
            is_war = False
            break
    if is_war:
        print('War')
else:
    print('War')

Submission status: Accepted

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

for i in range(x+1,y):
    if x1 < i and i <= y1:
        print("No War")
        break
else:
    print("War")

Submission status: Accepted

Solution code:
N,M,X,Y = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
max_A = max(A)
min_B = min(B)

for Z in range(X+1,Y+1):
  if max_A < Z and Z <= min_B:
    print("No War")
    break
else:
  print("War")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, M, X, Y, x, y):
    mx = max(x)
    my = min(y)

    error_print(mx, my)
    if mx >= my:
        return 'War'

    for i in range(mx+1, my+1):
        if X < i <= Y:
            return 'No War'
    return 'War'


def main():
    N, M, X, Y = read_int_n()
    x = read_int_n()
    y = read_int_n()
    print(slv(N, M, X, Y, x, y))


if __name__ == '__main__':
    main()

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()))
xi.sort()
yi.sort()
z=yi[0]
war=1
if(xi[n-1]>=yi[0]):
    print('War')
else:
    for z in range(xi[n-1]+1,yi[0]+1):
        if(z>x and z<=y):
            war=0
            break
    if(war):
        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()))

num =[i for i in range(X+1,Y+1) if i>max(x) and i<=min(y)]
if len(num)>=1:
  print('No War')
else:
  print('War')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
#a = int(input())
# スペース区切りの整数の入力

n,m,x,y = map(int, input().split())
xlist = [int(i) for i in input().split()]
ylist = [int(i) for i in input().split()]
#for num in range(1,m):
#    ylist+=[int(input())]

xlist.append(x)
ylist.append(y)

maxnum=max(xlist)
minnum=min(ylist)
# for num in range(0,n):
    #print("{}".format(xlist[num]))
# for num in range(0,m):
    #print("{}".format(ylist[num]))
#print("{} {}".format(a+b+c, s))
if maxnum<minnum:
    print("No War")
else:
    print("War")

Submission status: Accepted

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

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

xl.sort()
yl.sort()

xmax = xl[-1]
ymin = yl[0]

war = 'War'
nowar = 'No War'

kyokai = xmax + 1

isOk = False

if xmax < ymin:
    isOk = True
else:
    print(war)
    exit()

if kyokai <= ymin:
    pass
else:
    print(war)
    exit()

if X < kyokai:
    pass
else:
    print(war)
    exit()

if kyokai <= Y:
    pass
else:
    print(war)
    exit()


print(nowar)

Submission status: Accepted

Solution code:
def inpl(): return list(map(int, input().split()))
n,m,x,y = inpl()
xs = inpl()
ys = inpl()

for z in range(-100,101):
    if max(xs)<z and z<=min(ys) and x<z and z<=y:
        print('No War')
        break
else:
    print('War')

Submission status: Accepted

Solution code:


def main():
    N, M, X, Y = tuple(int(x) for x in input().split(" "))
    Xs = list(int(x) for x in input().split(" "))
    Ys = list(int(x) for x in input().split(" "))
    Xs.sort()
    Ys.sort()
    if Xs[-1] < Ys[0]:
        for n in range(Xs[-1]+1, Ys[0]+1):
            if X < n <= Y:
                print("No War")
                return
    print("War")




if __name__ == "__main__":
    main()

Submission status: Accepted

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

xlis = list(map(int, input().split()))
ylis = list(map(int, input().split()))


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

Submission status: Accepted

Solution code:
n,m,xPos,yPos = list(map(int,input().split()))
x = list(map(int,input().split()))
y = list(map(int,input().split()))
x.sort(reverse=True)
y.sort()
#FIX x,y add xPos,yPos
if x[0] >= y[0] or y[0] <= xPos or x[0] >= yPos :
    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()
if x[-1]<y[0] and y[0]>X and x[-1]<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.append(X)
B.append(Y)

maxA = max(A)
minB = min(B)

if minB > maxA :
    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()))
xl.sort()
yl.sort()
z = []
for i in range(x+1,y+1):
    z.append(i)
i = 0
while len(z) > i:
    if z[i] <= xl[n-1] or z[i] <= x:
        z.pop(i)
        continue
    if yl[0] < z[i] or y < z[i]:
        z.pop(i)
        continue
    i += 1
    if len(z) == 0:
        break
if len(z) > 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()))

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

count_x = sum(t < min_y for t in x)

re = 'War'
if count_x == N : # and count_y == M:
    if  X < min_y and min_y <= Y:
        re = 'No War'
    elif X < max_x + 1 and max_x + 1 <= Y:
        re = 'No War'
    
print(re)

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

flag = True

# condition 1
z_list = None
if x < y:
  z_list = range(x+1, y+1)
else:
  flag = False

# condition 2
x_cities.sort()
y_cities.sort()

for z in z_list:
  if x_cities[-1] < z <= y_cities[0]:
    break
else:
  flag = False
  
if flag == True:
  print('No War')
else:
  print('War')

Submission status: Accepted

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


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

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

    if x_max > y_min:
        print('War')
        exit()

    if x_max == y_min:
        if x < x_max <= y:
            print('No War')
            exit()

    for z in range(x_max, y_min + 1):
        if x < z <= y:
            print('No War')
            exit()

    print('War')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

N, M, X, Y = (int(i) for i in input().split())

xx = [int(i) for i in input().split()]
yy = [int(i) for i in input().split()]

mx = max(xx)
my = min(yy)

flag = 1

for i in range(201):
   Z = i - 100
   if (X < Z) and (Z <= Y) and (mx < Z) and (Z <= my):
       flag = 0

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
l=list(map(int,input().split()))
n=l[0]
m=l[1]
x=l[2]
y=l[3]

l1=max(list(map(int,input().split())))
l2=min(list(map(int,input().split())))
q=0
if l1<l2:
    if l1<y:
        if x<l2:
            print("No War")
            q=1
if q==0:
    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()))
j = 0
for i in range(x+1,y+1):
    if i > max(x_l) and i <= min(y_l):
        j+= 1
print("No War" if j else "War")

Submission status: Accepted

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

x.sort()
y.sort()
z = range(cx+1,cy+1)

ans = "War"
for v in z:
    if (v > x[n-1]) and (v <= y[0]):
        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()))
tempx = max(x)
tempy = min(y)
judge = False
for i in range(X+1,Y+1):
    if tempx < i <= tempy:
        judge = True
if judge:
    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:
  print('War')
elif max(x) >= Y:
  print('War')
elif X >= min(y):
  print('War')
elif max(x) >= min(y):
  print('War')
else:
  print('No War')

Submission status: Accepted

Solution code:
#encoding:utf-8

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

x = list(int(i) for i in input().split())
y = list(int(i) for i in input().split())

x.sort()
y.sort()

war_flag = 0

if X >= Y:
    war_flag = 1

if x[-1] >= y[0]:
    war_flag = 1

if y[0] <= X:
    war_flag = 1

if x[-1] >= Y:
    war_flag = 1

#print
if war_flag == 1:
    print("War")
else:
    print("No War")

Submission status: Accepted

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

X_Y=list(range(X+1,Y+1))
X_max=max(map(int, input().split()))
Y_min=min(map(int, input().split()))
count=0
for i in X_Y:
  if X_max<i and Y_min>=i:
    print('No War')
    count+=1
    break

if count!=1:
  print('War')

Submission status: Accepted

Solution code:
N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
xmax=-101
ymin=101
for i in range(N):
	if x[i]>xmax:
		xmax=x[i]
for i in range(M):
	if y[i]<ymin:
		ymin=y[i]
if ymin>xmax:
	if X<ymin and ymin<=Y:
		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.append(X)
y.append(Y)
if max(x)<min(y):
	print("No War")
else:
	print("War")

Submission status: Accepted

Solution code:
n,m,a,b=list(map(int,input().split()))
#n,m,a,b=[int(i) for i in input().split()]
x=[int(i) for i in input().split()]
y=[int(i) for i in input().split()]
print("No War" if (max(x)<min(y) and a<b and a<min(y) and b>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.sort()
x.reverse()
y.sort()


answer = 'War'

if X>=Y:
	answer = 'War'
if X<Y:	
	for i in range(X+1,Y+1):
		if x[0] < i <= y[0]:
			answer = 'No War'
	
print(answer)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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()]
flag = False

if min(y) > max(x):

    for i in range(max(x)+1,min(y)+1):

        if Y >= i > X:
            flag = True

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

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().split())
lis_x = list(map(int,input().split()))
lis_y = list(map(int,input().split()))
lis_x.sort()
lis_y.sort()
rest = []
for i in range(100):
    if i > lis_x[-1] and i <= lis_y[0]:
        rest.append(i)
for i in range(len(rest)):
    if x < rest[i] and rest[i] <= y:
        print('No War')
        exit()
print('War')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N,M,X,Y = map(int, input().split())
xn = list(map(int, input().split()))
ym = list(map(int, input().split()))

nowar = False
for Z in range(X+1,Y+1):
    if max(xn) < Z and Z <= min(ym):
        nowar = True

if nowar:
    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 = 1

if X >= Y:
    ans = 1
elif X < Y:
    z = list(range(X+1, Y+1))

for i in z:
    if max(x) < i and i <= min(y):
        ans = 0
        
if ans == 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()))
assert len(x) == N and len(y) == M

mx = max(x)
my = min(y)
nowar = mx < my and mx < Y and X < my

print("No War" if nowar else "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()))
c=max(a);d=min(b)
if c>=d:print('War')
else:
  if c>=y or d<=x:print('War')
  else:print('No War')

Submission status: Accepted

Solution code:
input_list = list(map(int, input().split()))
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))

a_list.sort()
b_list.sort()

a_max = a_list[-1]
b_min = b_list[0]

for n in range(input_list[2]+1, input_list[3]+1):
    if a_max < n <= b_min:
        print("No War")
        exit()
print("War")

Submission status: Accepted

Solution code:
n, m, xc, yc = [int(_) for _ in input().split(' ')]
x = [int(_) for _ in input().split(' ')]
y = [int(_) for _ in input().split(' ')]
x.append(xc)
y.append(yc)

if xc >= yc or max(x) >= min(y):
    print('War')
else:
    print('No War')

Submission status: Accepted

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

N,M,X,Y = inpl()
X = max(max(inpl()),X)
Y = min(min(inpl()),Y)
if X < Y:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
n, m, x, y = map(int, input().split())
x_list = [int(data) for data in input().split()]
y_list = [int(data) for data in input().split()]

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


def is_war(x, y):
    flag = "No War"
    for i in x:
        for j in y:
            if i >= j:
                flag = "War"
                return flag
    return flag


flag = is_war(x, y)
print(flag)

Submission status: Accepted

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

if min(y) > max(x):
    # max(x) + 1 <= z <= min(y)
    if (Y >= max(x) + 1) and (X < 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 = list(map(int, input().split()))
y = list(map(int, input().split()))

is_war = False
for Z in range(X + 1, Y + 1):
    if max(x) < Z and min(y) >= Z:
        is_war = True
        break
print('No War') if is_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 max(x_) > x:
    max_x = max(x_)
else:
    max_x = x

if min(y_) > y:
    min_y = y
else:
    min_y = min(y_)


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

Submission status: Accepted

Solution code:
def main():
    s = [int(item) for item in input().split()]
    _, _, X, Y = s
    xs = [int(item) for item in input().split()]
    ys = [int(item) for item in input().split()]
    mx = max(xs)
    my = min(ys)
    if mx >= Y:
        print('War')
        return
    if my <= X:
        print('War')
        return
    if mx >= my:
        print('War')
        return
    print('No War')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def inpl(): return list(map(int, input().split()))
n,m,x,y = inpl()
xs = inpl()
ys = inpl()

if max(xs)>=min(ys) or y<=max(xs) or min(ys)<=x:
    print('War')
else:
    print('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(' '))

if max(X,max(x)) + 1 <= min(Y,min(y)):
    print('No War')
else:
    print('War')

Submission status: Accepted

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

    flag = False
    

    for Z in range(A,B):
        if A < Z:
            if Z <= B:
                if max(X) < Z:
                    if min(Y) >= Z:
                        flag = True
                        ans = Z
    
    if flag:
        print("No War")

    else:
        print("War")

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

xl.sort()
yl.sort()

xmax = xl[-1]
ymin = yl[0]

war = 'War'
nowar = 'No War'

isOk = False

if xmax < ymin:
    isOk = True
else:
    print(war)
    exit()


if X < ymin and Y > xmax:
    isOk = True
else:
    print(war)
    exit()

print(nowar)

Submission status: Accepted

Solution code:
n, m, x, y = map(int, input().split())
xi = sorted(list(map(int, input().split())), reverse=True)
yi = sorted(list(map(int, input().split())), reverse=True)

xi.append(x)
yi.append(y)

if max(xi) >= min(yi):
    print("War")
    exit(0)

print("No War")

Submission status: Accepted

Solution code:
_, _, x, y = list(map(int, input().split()))
x_list = list(map(int, input().split()))
y_list = list(map(int, input().split()))

x_list.append(x)
x_list.sort()

y_list.append(y)
y_list.sort()

if x_list[0] < y_list[0]:
    if x_list[-1] >= y_list[0]:
        print("War")
    else:
        print("No War")
else:
    if y_list[-1] >= x_list[0]:
        print("War")
    else:
        print("No War")

Submission status: Accepted

Solution code:
# coding: utf-8


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

    war_happen = False

    for z in range(x + 1, y + 1):
        # print(z)
        if z > max(x_arr) and z <= min(y_arr):
            print('No War')
            return

    print('War')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = list(map(int,input().split()))
x = list(map(int,input().split()))
y = list(map(int,input().split()))

mx = max(x)
if mx < s[2]:
  mx = s[2]
my = min(y)
if my > s[3]:
  my = s[3]

  
if mx >= my:
  print ("War")
else:
  print ("No War")

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
ma_x = max(map(int, input().split()))
mi_y = min(map(int, input().split()))
for z in range(X + 1, Y + 1):
    if ma_x < z and mi_y >= z:
        print('No War')
        break
else:
    print('War')

Submission status: Accepted

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

xi = list(map(int,input().split()))

yi = list(map(int,input().split()))

if(max(xi+[x]) >= min(yi+[y])):
    print("War")
else:
    print("No War")

Submission status: Accepted

Solution code:
def main():
    data = list(map(int, input().split()))
    Xn = data[0]
    Yn = data[1]
    X = data[2]
    Y = data[3]

    Xs = list(map(int, input().split()))
    Ys = list(map(int, input().split()))

    mergin = list(range(X, Y))
    if not mergin:
        mergin.append(0)
    x_line = min(mergin)
    y_line = max(mergin)

    max_x = max(Xs)
    min_y = min(Ys)

    if (max_x < min_y):
        if ((max_x + min_y) // 2 in mergin):
            print('No War')
        else:
            print('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.sort()
_y.sort()

if max(_x) >= min(_y):
	print("War")
elif X >= min(_y):
	print("War")
elif Y <= max(_x):
	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()))
max_x = max(x)
min_y = min(y)
s1 = set([i for i in range(X + 1, Y + 1)])
s2 = set([i for i in range(max_x + 1, min_y + 1)])
if s1 & s2:
    print('No War')
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_max = max(xs)
ys_min = min(ys)
#print(xs_max, ys_min)
flag = True
for xi in range(xs_max+1, ys_min+1):
  #print(xi)
  if x<xi and xi<=y:
    print('No War')
    flag = False
    break
if flag:
  print('War')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
M, N, X, Y = list(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(y_min <= x_max):
    print("War")
    exit()

flag = 0
for i in range(x_max, y_min+1, 1):
    if(X <= i and i <= Y):
        flag = 0
    else:
        print("War")
        exit()
        
if(flag == 0): print("No War")
else: print("War")

Submission status: Accepted

Solution code:
import sys
n,m,x,y = map(int, input().split())
lis1 = [int(i) for i in input().split()]
lis2 = [int(i) for i in input().split()]
z = x+1
while z <= y:
  if max(lis1) < z and min(lis2) >= z:
    print('No War')
    sys.exit()
  else:
    z += 1
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:
def solve():
    _, _, X, Y = map(int, input().split())
    x = map(int, input().split())
    y = map(int, input().split())
    max_x = max(x)
    min_y = min(y)

    if X >= Y or max_x >= min_y or min_y <= X < Y or max_x >= Y > X:
        print("War")
        return

    print("No War")
    

if __name__=='__main__':
    solve()

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 = max(x) + 1
Z_max = min(y)

is_ok = False
for Z in range(Z_min, Z_max + 1):
    if X >= Z:
        continue
    if Z > Y:
        continue
    is_ok = True

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