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())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
x.append(X)
y.append(Y)
x = sorted(x)
y = sorted(y)

for z in range(-100,101):
    ans = "War"
    if z > max(x) and z <= min(y):
        ans = "No War"
        break
        
print(ans)

Submission status: Accepted

Solution code:
#coding: utf-8
n,m,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
x.sort()
y.sort()
if(x[-1]<y[0] and X<y[0] and x[-1]<Y):
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
l = input().split()


N = int(l[0])
M = int(l[1])
X = int(l[2])
Y = int(l[3])

"""
if X < -100:
    X = -100
elif X > 100:
    X = 100

if Y < -100:
    Y = -100
elif Y > 100:
    Y = 100
"""

lx = input().split()
ly = input().split()

lx = [int(z) for z in lx]
ly = [int(z) for z in ly]

lx = sorted(lx)


ly = sorted(ly)

flag = True


if int(ly[0]) - int(lx[N-1]) >= 1:
    for z in range(int(lx[N-1]) + 1, int(ly[0]) + 1):

        if z > X and z <= Y:
            flag = False
            break


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

Submission status: Accepted

Solution code:
#!/usr/bin/env python

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

if not(X < Y):
    print("War")
else:
    Z = list(range(X + 1, Y + 1))
    out = "War"
    for num in Z:
        if (max(X_arr) < num and num <= min(Y_arr)):
            out = "No War"
            break
    print(out)

Submission status: Accepted

Solution code:
from functools import reduce
from operator import and_

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

xs = list(map(int, input().split()))
ys = list(map(int, input().split()))

Z = -1
R = 'War'
for zz in range(X + 1, Y + 1):
    xb = reduce(and_, [x < zz for x in xs])
    yb = reduce(and_, [y >= zz for y in ys])
    if xb and yb:
        R = 'No War'
        break

print(R)

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

    for z in range(X + 1, Y + 1):
        if max(x) < z <= min(y):
            flg = True

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

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 X < x[N - 1] and y[0] <= Y and x[N - 1] < y[0]:
    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())

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

flag_war = True

for z in range(X+1, Y+1):
    if x_max < z:
        if y_min >= z:
            print('No War')
            flag_war = False
            break
        else:
            continue
    else:
        continue
if flag_war == True:
    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()))


xx = max(x)
yy = min(y)

if (X >= Y):
    print('War')
elif (xx >= yy):
    print('War')
elif (yy <= X):
    print('War')
elif (Y <= xx):
    print('War')
else:
    print('No War')

Submission status: Accepted

Solution code:
n, m, x, y = map(int,input().split())
lsx = input().split()
lsy = input().split()
lsx = list(map(int, lsx))
lsy = list(map(int, lsy))
z = False

lsxmax = max(lsx)
lsymin = min(lsy)
for i in range(x + 1, y + 1):
	if ((i > lsxmax) and (i <= lsymin)):
		z = True
if(z):
	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< max(x)<min(y)<Y:
    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()))



xlist.sort()
ylist.sort()

xmax=xlist[N-1]
ymax=ylist[M-1]
xmin=xlist[0]
ymin=ylist[0]



if X+1<=Y and xmax<ymin and xmax<Y and ymin>X:
    print("No War")
else:
    print("War")

Submission status: Accepted

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

# スペース区切りの整数N個の入力
x = [int(N) for N in input().split()]
y = [int(M) for M in input().split()]

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

#print('---')
#print(max(x),min(y))

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

Submission status: Accepted

Solution code:
str1 = input();
str2 = str1.split(" ")
n = int(str2[0])
m = int(str2[1])
xcap = int(str2[2])
ycap = int(str2[3])

strx = input()
stry = input()
strx2 = strx.split(" ")
stry2 = stry.split(" ")
for i in range(n):
    strx2[i] = int(strx2[i])

for i in range(m):
    stry2[i] = int(stry2[i])

if max(max(strx2),xcap) < min(min(stry2), ycap):
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
n, m, x, y = [int(i) for i in input().split()]
A = [int(i) for i in input().split()] + [x]
B = [int(i) for i in input().split()] + [y]

a = max(A)
b = min(B)

print('No War' if a < b 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(X<Y)
#print(min(y)-max(x)>0)
#print((Y>max(x) or X<min(y)))
if X<Y and (min(y)-max(x)>0) and (Y>max(x) and X<min(y)):
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
# B問題

# input parameters
n, m, x, y = map(int, input().split())
xlist = list(map(int, input().split()))
ylist = list(map(int, input().split()))

#compare integers
a = 0
if x < y:
    if max(xlist) < min(ylist):
        if (max(xlist) < y) and (x < min(ylist)):
            print('No War')
        else:
            print('War')
    else:
        print('War')
else:
    print('War')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 23 21:12:01 2018

@author: masato
"""

N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.sort()
y.sort()
xmin = x[0]
ymin = y[0]
xmax = x[-1]
ymax = y[-1]

z = max(xmax,ymin)

iswar = 0

for i in range(len(x)):
    if min(ymin,Y) <= x[i]:
        iswar = 1
        break
        
for j in range(len(y)):
    if max(xmax,X) >= y[j]:
        iswar = 1
        break

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

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

pos_cls = [[i, 'x'] for i in x]
pos_cls.append([X, 'x'])
pos_cls.extend([[i, 'y'] for i in y])
pos_cls.append([Y, 'y'])
pos_cls = sorted(pos_cls, key=lambda x:x[0])
if 'y' in [i[1] for i in pos_cls[:N+1]] or pos_cls[N][0] == pos_cls[N+1][0]:
	print 'War'
else:
	print 'No 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()]+[X]
y=[int(i) for i in input().split()]+[Y]

x.sort()
y.sort()

#print(x,y)

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

Submission status: Accepted

Solution code:
n,m,x,y = map(int, input().split())
px = list(map(int, input().split()))
py = list(map(int, input().split()))
# import ipdb; ipdb.set_trace()
if max(px) < min(py) and (x+1) < y and max(px) < y and x < min(py) :
    for z in range(x+1, y+1):
        if z in range(max(px), min(py)+1):
            print('No War')          
            break
    else:
        print('War')
else:
    print('War')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# !/usr/bin/env python
# vim: set fileencoding=utf-8 :

"""
#
# Author:   Noname
# URL:      https://github.com/pettan0818
# License:  MIT License
# Created: 日  9/23 21:17:33 2018

# Usage
#
"""
def get_input():
    first = [int(i) for i in input().split(" ")]
    second = list(sorted([int(i) for i in input().split(" ")]))
    third = list(sorted([int(i) for i in input().split(" ")]))

    return first[2], first[3], second, third

def judge(x, y, x_list, y_list):
    """
    >>> judge(10,20,[8,15], [16,22])
    >>> judge(-48, -1, [-20,-35,-91,-23], [-22, 66])
    >>> judge(6,8, [-10,3,1,5,-100], [100,6,14])
    """
    x_max = max(x_list)
    y_min = min(y_list)

    if x >= y:
        return False
    if x_max >= y_min:
        return False
    if y <= x_max:
        return False
    if y_min <= x:
        return False
    return True



if __name__ == '__main__':
    # import doctest
    # doctest.testmod()
    res = judge(*get_input())
    if res:
        print("No War")
    else:
        print("War")

Submission status: Accepted

Solution code:
f=input().split()
(n,m,x,y)=(int(f[0]),int(f[1]),int(f[2]),int(f[3]))
ax=[int(i) for i in input().split()]
ay=[int(i) for i in input().split()]
ax.sort()
ay.sort()
b=ay[0]-ax[-1]
c=0
if x<ax[-1] and y>ax[-1]:
    c=1
elif x>ax[-1] and x<ay[0] and y<ay[0]:
    c=1
elif x>ax[-1] and y>ay[0] and x<ay[0]:
    c=1
if b>0 and c==1:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
count = 0
N,M,X,Y = list(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 z>max(X,max(XL)) and z<=min(Y,min(YL)):
    count += 1 

if count>0:
  print('No War')
else:
  print('War')

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

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

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

Submission status: Accepted

Solution code:
a=map(int, raw_input().split())
b=map(int, raw_input().split())
c=map(int, raw_input().split())

b.sort()
c.sort()
b.reverse()

if b[0]<c[0] and a[2]<c[0] and b[0]<a[3]:
    print "No War"
else:
    print "War"

Submission status: Accepted

Solution code:
def judge_place_term(a_cities, b_cities, z):
    for city_x in a_cities:
        if z <= city_x:
            return False
    for city_y in b_cities:
        if z > city_y:
            return False

    return True

def judge_war(a_cities, b_cities, x, y):
    for z in range(x + 1, y + 1, 1):
        if judge_place_term(a_cities, b_cities, z):
            return False
    
    return True

stats = input().split(" ")

n = int(stats[0])
m = int(stats[1])
x = int(stats[2])
y = int(stats[3])

a_cities = [int(city) for city in input().split(" ")]
b_cities = [int(city) for city in input().split(" ")]

if judge_war(a_cities, b_cities, x, y):
    print("War")
else:
    print("No War")

Submission status: Accepted

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

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

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

battle_flag=False

X_max=max(x)
Y_min=min(y)

battle_flag=True

for Z in range(X,Y+1):
    if X_max<Z and Z<=Y_min:
        
        if X<Z and Z<=Y:
            battle_flag=False

if battle_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) or not(x<max(X)<min(Y)<y):
    print("War")
else:
    print("No War")

Submission status: Accepted

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

import sys

input1 = raw_input().split(" ")
input1 = [int(i) for i in input1]
N = input1[0]
M = input1[1]
X = input1[2]
Y = input1[3]

input2 = raw_input().split(" ")
input2 = [int(i) for i in input2]

input3 = raw_input().split(" ")
input3 = [int(i) for i in input3]


for i in range(X + 1, Y):
    if max(input2) < i <= min(input3):
        print "No War"
        sys.exit()

print "War"

Submission status: Accepted

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

xs.append(X)
ys.append(Y)

xs.sort()
ys.sort()


print('No War' if xs[-1] < ys[0] else 'War')

Submission status: Accepted

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

max_x = max(xs)
min_y = min(ys)

res = 'War'
for z in range(-100, 101):
    if max_x < z and x < z and z <= y and z <= min_y:
        res = 'No War'
        break
    else:
        pass
print(res)

Submission status: Accepted

Solution code:
t = list(map(int, input().split()))[2:]
x = list(map(int, input().split()))
y = list(map(int, input().split()))

x.append(t[0])
y.append(t[1])
if max(x) < min(y):
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
n,m,x,y = map(int,input().split())
xn = list(map(int,input().split()))
yn = list(map(int,input().split()))
for z in range(-100,102):
    temp1 = 0
    if not(x < z <= y):
        continue
    for i in range(len(xn)):
        if not(xn[i] < z):
            temp1 = 1
            break
    for i in range(len(yn)):
        if not(yn[i] >= z):
            temp1 = 1
            break
    if temp1 == 1:
        continue
    else:
        break
print("War" if z == 101 else "No War")

Submission status: Accepted

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

x.sort()
y.sort()

flag = 1

for i in z:
    if X<i<=Y and x[-1]<i and y[0]>=i:
        flag = 0
        
if flag == 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,min_y = max(x),min(y)

ans = ''
for Z in range(X+1,Y+1):
    if max_x < Z and Z <= min_y:
        ans = 'No '

print(ans+'War')

Submission status: Accepted

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

data_x = list(map(int,input().split()))
data_y = list(map(int,input().split()))

max_x = max(data_x)
min_y = min(data_y)

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

Submission status: Accepted

Solution code:
n, m, x, y = list(map(int, input().split()))
x_list = list(map(int, input().split()))
y_list = list(map(int, input().split()))
xmax = max(x_list)
ymin = min(y_list)
irange = y - x
for i in range(irange):
    if xmax < x+i+1 and x+i+1 <= ymin:
        print("No War")
        exit()
print("War")

Submission status: Accepted

Solution code:
N, M, X, Y = list(map(int, input().split()))
x = [0 for i in range(N)]
y = [0 for i in range(M)]
x = list(map(int, input().split()))
y = list(map(int, input().split()))
max_x = max(x)
min_y = min(y)
r = [i for i in range(max_x+1, min_y+1)]
count = 1
flag = False
while(True):
  if X + count in r:
    flag = True
    break
  else:
    if X + count == Y:
      break
    count += 1
if flag:
  print("No War")
else:
  print("War")

Submission status: Accepted

Solution code:
# coding:utf-8

INF = float('inf')


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


N, M, X, Y = inpl()
x = inpl()
y = inpl()
x.append(X)
y.append(Y)

x.sort()
y.sort()


if y[0] - x[-1] >= 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()]
y = [int(i) for i in input().split()]

flag=False

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

if X >= ymin:
    flag = True

if Y <= xmax:
    flag = True

if ymin - xmax <= 0:
    flag = True

if flag == False:
    print("No War")

else:
    print("War")

Submission status: Accepted

Solution code:
def answer(input0, input1, input2):
    values = [int(n) for n in input0.split(" ")]
    x = values[2]
    y = values[3]
    # print(x, y)

    if x >= y:
        return False

    xa = sorted([int(n) for n in input1.split(" ")], reverse=True)
    # print(xa)

    ya = sorted([int(n) for n in input2.split(" ")], reverse=True)
    # print(ya)

    x0 = xa[0]
    yN = ya[len(ya)-1]

    if yN <= x0:
        return False

    candidate = yN - x0

    for i in range(candidate):
        z = yN - i
        if x0 < z and z <= yN and x < z and z < y:
            return True

    return False

res = answer(input(), input(), input())
if res:
    print("No War")
else:
    print("War")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
iN,iM,iX,iY = [int(x) for x in input().split()]
aX = [int(x) for x in input().split()]
aY = [int(x) for x in input().split()]

aX.append(iX)
aY.append(iY)

if max(aX) < min(aY) :
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
e = input().split()
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]

a = int(e[0])
b = int(e[1])
c = int(e[2])
d = int(e[3])

x.append(c)
y.append(d)
xmax = max(x)
ymax = min(y)

if xmax < ymax:
    print("No War")
else:
    print("War")
"""
if xmax < ymax:
    if c < ymax:
        if xmax < d:
            print("No War")
        else:
            print("War")
    else:
        print("War")
else:
    print("War")
"""

Submission status: Accepted

Solution code:
def test():
  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.sort()
  y.sort()

  for i in range(X+1, Y+1):
    if x[N-1] < i and i <= y[0] and X < i and i <= Y:
      print("No War")
      return 0

  print("War")
  
test()

Submission status: Accepted

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

res = 'No War'
xn_max = max(xn_list)
ym_min = min(ym_list)
y = int(y)
x = int(x)

if xn_max >= ym_min or xn_max >= y or x >= ym_min:
    res = 'War'

print(res)

Submission status: Accepted

Solution code:
panels = input().split()
panels = [int(panel) for panel in panels]

N,M,X,Y = panels[:]
domain = set(range(X+1,Y+1))

x_enp = input().split()
x_enp = [int(place) for place in x_enp]
y_enp = input().split()
y_enp = [int(place) for place in y_enp]

x_max = max(x_enp)
y_min = min(y_enp)

if y_min <= x_max:
    print("War")
else:
    evaluation = set(range(x_max+1,y_min+1))
    
    if evaluation & domain:
        print("No War")
    else:
        print("War")

Submission status: Accepted

Solution code:
import math
n, m,x,y = list(map(int, input().split())) # 整数
arrayx = list(map(int, input().strip().split()))
arrayy = list(map(int, input().strip().split()))
arrayx.sort()
arrayy.sort()
#print(arrayx[n-1])
#print(arrayy[0])
ans=0
for i in range(x+1,y+1):
    #print(i)
    if i>arrayx[n-1]:
        if i<=arrayy[0]:
            ans=1
if ans==0:
    print("War")
if ans==1:
    print("No War")

Submission status: Accepted

Solution code:
def helper(n,m,x,y,X,Y):
	for i in range(x+1,y+1):
		if all(n<i for n in X) and all(n>=i for n in Y):
			return "No War"
	return "War"

n,m,x,y=map(int,raw_input().split(' '))
X = map(int,raw_input().split(' ')) 
Y = map(int,raw_input().split(' '))
print helper(n,m,x,y,X,Y)

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_max = max(x)
y_min = min(y)

def check_war():
    for z in range(X+1, Y+1):
        if x_max < z and z <= y_min:
            return 'No War'
    return 'War'

print(check_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()
res = False
for z in range(x+1, y+1):
    if X[-1] < z <= Y[0]:
        res = True
if(res):
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readlines()

line1 = input[0].split()
x = input[1].split()
y = input[2].split()

x = [int(n) for n in x]
y = [int(n) for n in y]

N = int(line1[0])
M = int(line1[1])
X = int(line1[2])
Y = int(line1[3])

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

if x_max > X:
    x_border = x_max
else:
    x_border = X
if y_min < Y:
    y_border = y_min
else:
    y_border = Y

if x_border < y_border:
    print('No War')
else:
    print('War')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l = input().split(" ")
n= int(l[0])
m= int(l[1])
x= int(l[2])
y= int(l[3])
xcon=[]
ycon= []

xcon = input().split(" ")
for i in range(n):
    xcon[i] = int(xcon[i])

ycon = input().split(" ")
for i in range(m):
    ycon[i]=int(ycon[i])

xcon = sorted(xcon)
ycon = sorted(ycon)

if max(x,xcon[-1]) < min(ycon[0],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(" ")))

flug1=False
flug2=False
Z=0
for i in range(X,Y+1):
    for j in range(N):
        if i<=x[j]:
            flug1=True
            break

    for j in range(M):
        if i>y[j]:
            flug1=True
            break

    if flug1==False:
        flug2=True
        Z=i
        
    flug1=False

if flug2:
    if Z>X and Z<=Y:
        print("No War")
    else:
        print("War")
else:
    print("War")

Submission status: Accepted

Solution code:
N,M,X,Y = map(int,input().split(" "))
list1 = list(map(int,input().split(" ")))
list2 = list(map(int,input().split(" ")))
list1.sort(reverse=True)
list2.sort()
while(True):
    if list1[0] >= Y:
        print("War")
        break
    if list2[0] <= X:
        print("War")
        break
    if list1[0] >= list2[0]:
        print("War")
        break
    elif list2[0] < Y:
        print("No War")
        break

Submission status: Accepted

Solution code:
s = list(map(int,input().split()))
t = list(map(int,input().split()))
u = list(map(int,input().split()))
if s[2] < max(t) < min(u) <= s[3]:
 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()))

xList.append(x)
yList.append(y)

xList.sort()
xList.reverse()
yList.sort()


if(yList[0]-xList[0]>=1):
  print("No War")
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()))
x_max = max(xi)
y_min = min(yi)
a = 0
if x_max < y_min:
    if x < y_min and y > x_max:
        a += 1
if a >= 1:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
from sys import stdin
def isWar_X(z, lst):
    for i in range(len(lst)):
        if lst[i] >= z:
            return True
    return False

def isWar_Y(z, lst):
    for i in range(len(lst)):
        if lst[i] < z:
            return True
    return False

def isWar(X, Y, xs, ys):
    for z in range(X+1, Y):
        if (not(isWar_X(z, xs)) and not(isWar_Y(z, ys))):
            return "No War"
    return "War"

N, M, X, Y = [int(x) for x in stdin.readline().rstrip().split()]
xs = [int(x) for x in stdin.readline().rstrip().split()]
ys = [int(x) for x in stdin.readline().rstrip().split()]
print(isWar(X,Y, xs, ys))

Submission status: Accepted

Solution code:
def main():
    n, m, 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)
    y_list.append(y)

    zx = max(x_list) + 1
    zy = min(y_list)

    if zx > zy :
        print('War')
    else:
        print('No 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()
 
 
for i in range(x[N-1]+1,y[0]+1):
  if i>X and i<=Y:
    print('No War')
    exit()
print('War')

Submission status: Accepted

Solution code:
N,M,X,Y= map(int, raw_input().split())
xlist= map(int, raw_input().split())
ylist= map(int, raw_input().split())
xlist.sort()
ylist.sort()
if X<xlist[-1]<Y<ylist[0] or xlist[-1]<X<Y<ylist[0] or X<xlist[-1]<ylist[0]<Y or xlist[-1]<X<ylist[0]<Y:
    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()))
xmax = max(xlist)
ymin = min(ylist)
if xmax<ymin:
    for z in range(xmax+1, ymin+1):
        if X<z<=Y:
            print("No War")
            break
    else:
        print("War")
else:
    print("War")

Submission status: Accepted

Solution code:
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F551C':
    sys.stdin = open('b1.in')


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


def read_str_list():
    return input().split()


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


def read_str():
    return input()


def main():
    N, M, X, Y = read_int_list()
    x = read_int_list()
    y = read_int_list()
    x.append(X)
    y.append(Y)
    if max(x) < min(y):
        res = 'No War'
    else:
        res = 'War'
    print(res)


main()

Submission status: Accepted

Solution code:
import sys
N,M,X,Y = map(int,input().split())
if X >= Y:
  print('War')
  sys.exit()
x = input().split()
y = input().split()
x = [int(el) for el in x]
y = [int(el) for el in y]
x.sort(reverse=True)
y.sort()
z = [i for i in range(X+1,Y+1)]
judge = 0
for el in z:
  if x[0] < el and y[0] >= el:
    judge += 1
if judge > 0:
  print('No War')
else:
  print('War')

Submission status: Accepted

Solution code:
N, M, X, Y = list(map(int, input().split()))
cx = list(map(int, input().split()))
cy = list(map(int, input().split()))
if min(cy) - max(cx) < 1:
    print("War")
    exit()
z_max = min(cy)
z_min = max(cx) + 1
if z_min > Y or X+1 > z_max:
    print("War")
else:
    print("No War")

Submission status: Accepted

Solution code:
xy=input().split()
X=xy[2]
Y=xy[3]
n=input().split()
n.append(X)
n=[int(i) for i in n]
n=sorted(n)
m=input().split()
m.append(Y)
m=[int(i) for i in m]
m=sorted(m)
x=n[-1]
y=m[0]
if x>=y:
    print("War")
else:
    print("No 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( )))
z_l=list(range(X+1,Y+1))
ans='War'
for z in z_l:
    x=list(filter(lambda x: x<z, x_l))
    y=list(filter(lambda y: y>=z, y_l))
    if len(x)==n and len(y)==m:
        ans=('No War')
print(ans)

Submission status: Accepted

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

print(["War","No War"][x[-1] < y[0]])

Submission status: Accepted

Solution code:
n, m, X, Y =(int(x) for x in 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) and z <= min(y):
        print('No War')
        break
    if z == Y:
        print('War')

Submission status: Accepted

Solution code:
n, m, x, y = [int(i) for i in input().split(" ")]
x_range = [int(i) for i in input().split(" ")]
y_range = [int(i) for i in input().split(" ")]
war = True
for z in range(x, y):
    if x < z <= y and max(x_range) < z <= min(y_range[:m]):
        war = False
print("War" if war else "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()))
x_max = max(xs)
y_min = min(ys)
def get_war(x_max, y_min, X, Y):
    if y_min > x_max:
        for z in list(range(x_max+1, y_min + 1)):
            if (z > X) and (z <= Y):
                return 'No War'
            else:
                pass
        else:
            return 'War'
    else:
        return 'War'
print(get_war(x_max, y_min, X, Y))

Submission status: Accepted

Solution code:
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 X>= Y:
  print('War')
else:
  xmax = max(x)
  ymin = min(y)
  if xmax >= ymin:
    print('War')
  elif xmax>=Y:
    print('War')
  elif X>= ymin:
    print('War')
  else:
    print('No 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 = xs + [x]
ys = ys + [y]

max_x = sorted(xs)[-1]
min_y = sorted(ys)[0]



if max_x < min_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())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
x.append(X)
y.append(Y)
x = sorted(x)
y = sorted(y)

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