Problem:


Score : 200 points

Problem Statement

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

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

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

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

X < Z \leq Y

x_1, x_2, ..., x_N < Z

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

Determine if war will break out.

Constraints

All values in input are integers.

1 \leq N, M \leq 100

-100 \leq X < Y \leq 100

-100 \leq x_i, y_i \leq 100

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

x_i are all different.

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

y_i are all different.

Input

Input is given from Standard Input in the following format:

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

Output

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

Sample Input 1

3 2 10 20
8 15 13
16 22

Sample Output 1

No War

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

X = 10 < 16 \leq 20 = Y

8, 15, 13 < 16

16, 22 \geq 16

Sample Input 2

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

Sample Output 2

War

Sample Input 3

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

Sample Output 3

War



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


Sample output:
No War

Submission status: Accepted

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

N, M, X, Y = map(int, input().split())
LX = [int(v) for v in input().split()]
LY = [int(v) for v in input().split()]

mx = max(LX)
my = min(LY)

n = mx + 1
while n <= my:
    if X < n and n <= Y:
        print("No War")
        exit()
    else:
        n += 1
        
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()))

war_flag = 0
for i in range(X+1,Y+1):

    for j in range(N):
        if i <= x_list[j]:
            war_flag = 1
            break
        else:
            war_flag = 0
    if war_flag == 1:
        continue
    
    for k in range(M):
        if i > y_list[k]:
            war_flag = 1
            break
        else:
            war_flag = 0

    if war_flag == 0:
        print('No War')
        exit()

print('War')

Submission status: Accepted

Solution code:
f = lambda: list(map(int, input().split()))
N, M, X, Y = f()
x_max = max(f())
y_min = min(f())
print('No War') if any([True for Z in range(x_max + 1, y_min + 1) if X < Z <= Y]) else print('War')

Submission status: Accepted

Solution code:
def answer(n, m, x, y, x_array, y_array):
    max_x = x
    for i in range(n):
        if x_array[i] > max_x:
            max_x = x_array[i]


    min_y = y
    for i in range(m):
        if y_array[i] < min_y:
            min_y = y_array[i]

    if max_x < min_y:
        return "No War"
    else:
        return "War"


[n, m, x, y] = list(map(int, input().split()))
x_array = list(map(int, input().split()))
y_array = list(map(int, input().split()))
    
print(answer(n, m, x, y, x_array, y_array))

Submission status: Accepted

Solution code:
N, M, X, Y = list(map(int,input().split()))
lst_x = input().split()
lst_x_int=[int(i) for i in lst_x]
lst_y = input().split()
lst_y_int=[int(i) for i in lst_y]
#print(lst_x_int,lst_y_int)
#print(max(lst_x_int),min(lst_y_int))

if max(lst_x_int)+1 <= min(lst_y_int) and X < min(lst_y_int) and max(lst_x_int) < Y:
  print("No War")
else:
  print("War")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun May 19 14:58:56 2019

@author: Yamazaki Kenichi
"""

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] or x[-1] >= Y or y[0] <= 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()))
amax, bmin = max(x), min(y)
OK = False
for Z in range(amax+1,bmin+1):
    if X < Z and Z <= Y:
        OK = True
if OK:
    print("No War")
else:
    print("War")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
B - 1 Dimensional World's Tale
https://atcoder.jp/contests/abc110/tasks/abc110_b

"""
import sys


def solve(X, Y, x_cities, y_cities):
    for z in range(x_cities[-1]+1, y_cities[0]+1):
        if X < z <= Y:
            return 'No War'
    return 'War'


def main(args):
    N, M, X, Y = map(int, input().split())
    x_cities = sorted(map(int, input().split()))
    y_cities = sorted(map(int, input().split()))
    ans = solve(X, Y, x_cities, y_cities)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

Solution code:
n,m,x,y= map(int, input().split())
lix = sorted(list(map(int, input().split())))
liy = sorted(list(map(int, input().split())))
if lix[-1] < liy[0] and x < liy[0] and lix[-1] < y:
  print('No War')
  exit()
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()))

    x.sort(reverse=True)
    y.sort()

    x_max = max(X, x[0])
    y_min = min(Y, y[0])

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

Submission status: Accepted

Solution code:
n, m, x, y = map(int, input().split())
xlist = list(map(int, input().split()))
ylist = list(map(int, input().split()))
max_x = max(xlist)
min_y = min(ylist)
flg = 0
for i in range(max_x+1, min_y+1):
    if i>x and i<=y:
        flg=1
        break
if flg ==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()))
x.sort(reverse=True)
y = list(map(int,input().split()))
y.sort()
if x[0] < y[0] and X < y[0] and x[0] < Y:
    print('No War')
else:
    print('War')

Submission status: Accepted

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

n=list(map(int, input().split()))
m=list(map(int, input().split()))
n.append(x)
m.append(y)
n=sorted(n)
m=sorted(m)

if n[len(n)-1] < m[0]:
  print('No War')
else:
  print('War')

Submission status: Accepted

Solution code:
N,M,X,Y = map(int,input().split())
x = sorted(list(map(int,input().split())))
y = sorted(list(map(int,input().split())))
if X < x[-1] < y[0] <=Y :
    print("No War")
else:
    print('War')

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()))
x_result = False
y_result = False
is_war = True


for z in range(x + 1, y + 1):
    
    if max(X) < z:
        x_result = True
    else:
        x_result = False

    if min(Y) >= z:
        y_result = True
    else:
        y_result = False

    if x_result and y_result:
        is_war = False
        break

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

Submission status: Accepted

Solution code:
#ABC 110 B
n, m, x, y = map(int, input().split())
max_x = max(list(map(int, input().split())))
min_y = min(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())
xlist = list(map(int, input().split()))
ylist = list(map(int, input().split()))

if max(xlist) < min(ylist):
    check = 0
    for z in range(max(xlist)+1, min(ylist)+1):
        if z > X and z <= Y:
            check = 1
            break
    if check == 1:
        print('No War')
    else:
        print('War')

else:
    print('War')

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
z = 'War'
for i in range(c+1, d):
    if max(x) < i:
        if min(y) >= i:
            z = 'No War'
print(z)

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 X < Y and X < min_y and Y > max_x and max_x < min_y:
    print('No War')
else:
    print('War')

Submission status: Accepted

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

if max(area_x) < min(area_y):
  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()]
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()))

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

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=max(map(int,input().split()))
y=min(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, input().split())
x = sorted([int(i) for i in input().split()])
y = sorted([int(i) for i in input().split()])

flag = True
for i in range(X + 1, Y + 1):
    if x[-1] < i and i <= y[0]:
        flag = False
        break
print("War" if flag else "No War")

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

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

def main():
    Zs = list(range(X+1,Y+1))
    for _ in Zs:
        if max(xs) < _ <= min(ys):
            print("No War")
            sys.exit()
    print("War")

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n,m,x,y = map(int,input().split())
z = [i for i in range(x+1,y+1)]
x_p = max(list(map(int,input().split())))
y_p = min(list(map(int,input().split())))

z = list(filter(lambda x: x>x_p,z))
z = list(filter(lambda x: x<=y_p,z))
print('War' if z == [] else 'No War')

Submission status: Accepted

Solution code:
n,m,X,Y = map(int,input().split())
x = [int(j) for j in input().split()]
y = [int(j) for j in input().split()]
x.append(X)
y.append(Y)
if min(y) > max(x):
    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()]
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)+1<=min(y):
  for i in range(X+1,Y+1):
    if i>=max(x)+1 and i<=min(y):
      print('No War')
      exit()
print('War')

Submission status: Accepted

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

x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.sort()
y.sort()
x_tmp = max(x[-1], X)
y_tmp = min(y[0], Y)
print('No War' if x_tmp < y_tmp else 'War')

Submission status: Accepted

Solution code:
n,m,X,Y = map(int,input().split())
x = list(map(int,input().split()))
x = sorted(x)
y = list(map(int,input().split()))
y = sorted(y)
a = max(X,x[-1])
b = min(Y,y[0])
if a<b:
        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 and X < Y and X < min_y and max_x < Y:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
xmax = max(map(int, input().split() + [X]))
ymin = min(map(int, input().split() + [Y]))
 
if xmax < ymin:
    print("No War")
else:
    print("War")

Submission status: Accepted

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

X_list = [X]
X_list.extend(list(map(int, input().split())))
Y_list = [Y]
Y_list.extend(list(map(int, input().split())))


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()))
judge = False
for i in range(X+1,Y):
    if all([v < i for v in x]) and all([v >= i for v in y]):
        judge = True
        break
if judge:
    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()))

z1 = max(x) + 1
z2 = min(y)

if X < z1 and z1 < Y:
    if X < z2 and z2 < Y:
        if z1 <= z2:
            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 and Mx < Y and my > X:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
###############################################################################

from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy

def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance


###############################################################################


def main():
    n, m, x, y = intin()
    xlist = intina()
    ylist = intina()

    for z in range(x, y):
        z = z + 1

        peace = True

        for x in xlist:
            if x >= z:
                peace = False

        for y in ylist:
            if y < z:
                peace = False

        if peace:
            print('No War')
            return

    print('War')


if __name__ == '__main__':
    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_max = max(x_list)
y_min = min(y_list)

z = [i for i in range(-100,100) if i > x and i <= y and i > x_max and i <= y_min]
if not z:
    print("War")
else:
    print("No War")

Submission status: Accepted

Solution code:
N,M,X,Y = [int(a) for a in input().split(" ")]
xs=[int(a) for a in input().split(" ")]
ys=[int(a) for a in input().split(" ")]
x0, y0 = max(xs), min(ys)
print("No War" if X<y0 and x0<y0 and x0<Y else "War")

Submission status: Accepted

Solution code:
#2
n,m,x,y = map(int,input().split())
listx = [int(i) for i in input().split()]
listy = [int(i) for i in input().split()]
listx.append(x)
listy.append(y)
maxx = max(listx)
miny = min(listy)
if (miny > maxx):
    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(reverse = True)
y.sort()
if x[0]<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()))
maxs = max(x)
mins = min(y)

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

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

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

Submission status: Accepted

Solution code:
q=lambda:list(map(int,input().split()))
n,m,x,y=q()
a=q()
b=q()
print(['','No '][max(a)<min(b)and x<min(b)and max(a)<y]+'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()))
c = []
for i in range(x + 1, y + 1):
    count = 0
    for j in range(len(xs)):
        if xs[j] >= i:
            count += 1
    for k in range(len(ys)):
        if ys[k] < i:
            count += 1
    c.append(count)
if c.count(0) >= 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())))

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

print("No War" if min_y - max_x > 0 else "War")

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().split())
a=map(int,input().split())
b=map(int,input().split())
A=max(a)
B=min(b)
D=0
for w in range(A+1,B+1):
 if x<w<=y:
  D+=1

if D>=1:
 print ("No War")
else:
 print("War")

Submission status: Accepted

Solution code:
import sys
n,m,X,Y = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
z=[]
for i in range(-100,101):
    if X < i <= Y:
        z.append(i)
for i in range(len(z)):
    if max(x) < z[i] <= min(y):
        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()))
ans = 'No War'
max = X
for i in range(N):
    if x[i]>max:
        max = x[i]
min = Y
for i in range(M):
    if y[i]<min:
        min = y[i]

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

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
print('No War' if max(max(x), X) < min(min(y), Y) else '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.sort(reverse=True)
y.sort()

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

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
XY = []
for i in range(2):
    tmp = list(map(int, input().split()))
    XY.append(tmp)

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

Submission status: Accepted

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

Submission status: Accepted

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

N, M, X, Y = [int(c) for c in input().split()]
xls = [int(x) for x in input().split()]
yls = [int(c) for c in input().split()]
if max (xls) < min(yls) and Y > max(xls) and X < min(yls):
    print('No War')
else:
    print('War')

Submission status: Accepted

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

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

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


for i in range(X + 1, Y + 1):
    if x_max < i and i <= y_min:
        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)

X.sort()
Y.sort()

if X[-1] >= Y[0]:
    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()))
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())
xs = list(map(int,input().split()))
xs.append(x)
ys = list(map(int,input().split()))
ys.append(y)

if max(xs) < min(ys):
    print('No War')
else:
    print('War')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
from math import *
from itertools import *
from collections import *
from functools import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


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


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    x = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    y = [ int(next(tokens)) for _ in range(M) ]  # type: "List[int]"
    result = solve(N, M, X, Y, x, y)
    print(result)

if __name__ == '__main__':
    main()

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()))
x_max = max(x, max(xs))
y_min = min(y, min(ys))
print("No War") if x_max < y_min else print("War")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().split())
x_list=list(map(int,input().split()))
y_list=list(map(int,input().split()))
x_list.append(x)
y_list.append(y)
x_list.sort()
y_list.sort()
if x_list[-1]<y_list[0]:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
N,M,Xa,Ya = map(int,input().split())
X = list(map(int,input().split()))
Y = list(map(int,input().split()))
if max(X)<min(Y) and min(Y) > Xa and max(X) < Ya:
    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()]

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

print('War')

Submission status: Accepted

Solution code:
#!/usr/bin/env python
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):
    if max_x < z and z <= min_y:
        print('No War')
        break
else:
    print('War')

Submission status: Accepted

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

ans = False

for i in range(x + 1, y + 1):
    if xm < i and i <= ym:
        ans = True
        break
        
if ans:
    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()))

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

a = max(x)
b = min(y)

if a < b:
    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):
    if max(x) < z <= min(y):
        print("No War")
        exit()
print("War")

Submission status: Accepted

Solution code:
N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
x.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()))
for i in range(x+1,y+1):
    if i>max(a) and i<=min(b):
        print("No War")
        exit()
else:
    print("War")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
N, M, X, Y = map(int, input().split())
xlist = input().split() # string
ylist = input().split() # string

#intXlist = intYlist = []
intXlist = []
intYlist = []
for i in xlist:
    intXlist.append(int(i))
#intXlist.append(X)
for i in ylist:
    intYlist.append(int(i))
#intYlist.append(Y)

# print(max(intXlist))
# print(min(intYlist))

# mx = max(intXlist)
# my = min(intYlist)

# for z in range(X+1, Y+1):
#     return my <= mx:
#         print('No War')
#         sys.exit()
#     else:
#         continue
# print('War')


def judge(z):
    try:
        for i in xlist:
            i = int(i)
            if not i < z:
                return 0
            else:
                continue
        for j in ylist:
            j = int(j)
            if j < z:
                return 0
            else:
                if str(j) == ylist[-1]:
                    #print(z)
                    print('No War')
                    sys.exit()
    except Exception as e:
        print(e)
for z in range(X+1, Y+1):
    judge(z)
    if z == Y:
        print('War')

Submission status: Accepted

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

if A[N-1] >= B[0]:
  print('War')
else:
  for Z in range(A[N-1]+1,B[0]+1):
    if A[N-1] < Z <= B[0] and X < Z <= Y:
      if Z == B[0]:
        print('No War')
        break
    else:
      print('War')
      break

Submission status: Accepted

Solution code:
N,M,X,Y = map(int,input().split())
x = sorted(list(map(int,input().split())))
y = sorted(list(map(int,input().split())))
if X <= x[-1] < y[0] <= Y:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
def main():
  N,M,X,Y = map(int, input().split())
  max_x = max(map(int,input().split()))
  min_y = min(map(int,input().split()))
  max_xx = max(max_x,X)
  min_yy = min(min_y,Y)
  #print(max_x)
  #print(min_y)
  #print(max_xx)
  #print(min_yy)
  
  if min_yy - max_xx > 0:
    print("No War")
  else:
    print("War")
    
main()

Submission status: Accepted

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

a_pos.sort()
b_pos.sort()

num = a_pos[-1] + 1

ansflg = 0
for z in range(X + 1, Y + 1):
  flg = 1
  for x in a_pos:
    if z <= x:
      flg = 0
      break
  if flg:
    for y in b_pos:
      if y < z:
        flg = 0
        break
  if flg:
    ansflg = 1
    break

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