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: Wrong Answer

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

    print(max(X))
    print(max(Y))
    flag = False
    

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
nums = [int(num) for num in input().split()]
n = nums[0]
m = nums[1]
x = nums[2]
y = nums[3]
maxx =-100
miny =100
hogex = [int(num) for num in input().split()]
hogey = [int(num) for num in input().split()]
for i in range(n):
    maxx = max(hogex[i],maxx)
for i in range(m):
    miny = min(miny,hogey[i])

if maxx < y and miny >=x and maxx <miny:
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

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)
# print(tempx)
# print(tempy)
judge = False
if tempx>tempy:
    print("War")
else:
    for i in range(tempx,tempy+1):
        if X < i <=Y:
            judge=True
    if judge:
        print("No War")
    else:
        print("War")

Submission status: Wrong Answer

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: Wrong Answer

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()
if(xi[n-1]>yi[0] or yi[0]<=x or xi[n-1]>=y):
    print('War')
else:
    print('No War')

Submission status: Wrong Answer

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.sort()
y.sort()

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

Submission status: Wrong Answer

Solution code:
def helper(n,m,x,y,X,Y):
	e = max(X)
	f = max(Y)
	for i in X:
		if x<i<=y and e<i and f>=i:
			return "No War"
	for i in Y:
		if x<i<=y and e<i and f>=i:
			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: Wrong Answer

Solution code:
N,M,X,Y=sorted(map(int, input().split()))
xi=sorted(map(int, input().split()))
yi=sorted(map(int, input().split()))
Zx = xi[-1]
Zy = yi[ 0]
if X < Zy and Zy <= Y and Zx < Zy:
  print('No War')
else:
  print('War')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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
while z <= y:
  if max(lis1) < z and min(lis2) >= z:
    print('No War')
    sys.exit()
  else:
    z += 1
print('War')

Submission status: Wrong Answer

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: Wrong Answer

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()
    print(Xs)
    print(Ys)
    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: Wrong Answer

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.sort()
y_list.sort()
if x_list[-1] < y_list[0]:
  if y_list[0] > x and x_list[-1] <= y:
    print("No War")
  else:
    print("War")
else:
  print("War")

Submission status: Wrong Answer

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:
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

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

res = 'No War'

for i in xs:
    for j in ys:
        if i >= j or x >= j or i >= y or x >= y:
            res = 'War'

print(res)

Submission status: Wrong Answer

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()
if(xi[n-1]>yi[0] or yi[0]<=x):
    print('War')
else:
    print('No War')

Submission status: Wrong Answer

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: Wrong Answer

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

def main():
    n, m, x, y = map(int, input().split())
    x_list = list(map(int, input().split()))
    y_list = list(map(int, input().split()))
    for z in range(x + 1, y+1):
        if all(x < z for x in x_list) and all(y >= z for y in y_list):
            print('No War')
            print(z)
            exit()
    print('War')

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:

n, m, x, y = list(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-1) and x < (y-1):
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

Solution code:


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

if X < Y:
    xs = sorted(a[0])
    ys = sorted(a[1])
    if xs[-1] < ys[0]:
        print('No War')
    else:
        print('War')
else:
    print('War')

Submission status: Wrong Answer

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 my - mx > 1:
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

Solution code:
n, m, x, y = map(int,input().split())
lx = list(map(int,input().split()))
ly = list(map(int,input().split()))
lx.append(x)
ly.append(y)
lx_max = max(lx)
ly_min = min(ly)

if lx_max > ly_min:
  print('War')
else:
  print('No War')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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):
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

Solution code:
_, _, x, y = map(int, input().split())
x_cities = map(int, input().split())
y_cities = map(int, input().split())

max_x, min_y = max(x_cities), min(y_cities)
if max_x < min_y and x < min_y < y:
  print("No war")
else:
  print("War")

Submission status: Wrong Answer

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.sort()
y_list.sort()
if x_list[-1] < y_list[0]:
  if y_list[0] > x:
    print("No War")
  else:
    print("War")
else:
  print("War")

Submission status: Wrong Answer

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 = "War"
flag = 0
if Y > X:
    for i in range(X, Y+1):
        if x[-1] < i <= y[0]:
            res = "No War"
            flag = 1
            break
    if flag == 1:
        print("No War")
    else:
        print("War")
else:
    print("War")

Submission status: Wrong Answer

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

xak = list(map(int,input().split(" ")))
yak = list(map(int,input().split(" ")))

x_max = max(xak)
y_min = min(yak)

if x_max >= y_min:
    print("War")
else:
    for i in range(x_max,y_min+1):
        if x < i <= y:
            print("No War")
            break
    else:
        print("War")

Submission status: Wrong Answer

Solution code:
n, m, x, y = list(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-1):
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

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) & X<min(y):
  print('No War')
  exit()

print('War')

Submission status: Wrong Answer

Solution code:
N, M, X, Y = map(int, raw_input().split(' '))
Xs = sorted(map(int, raw_input().split(' ')))
Ys = sorted(map(int, raw_input().split(' ')))

if Xs + Ys == sorted(Xs + Ys) and max(Xs) < min(Ys) and max(Xs) < Y and min(Ys):
    print 'No War'
else:
    print 'War'

Submission status: Wrong Answer

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 Y-X>1:
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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 = "War"
flag = 0
if Y > X:
    for i in range(X, Y):
        if x[-1] < i <= y[0]:
            res = "No War"
            flag = 1
            break
    if flag == 1:
        print("No War")
    else:
        print("War")
else:
    print("War")

Submission status: Wrong Answer

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

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

if max(x) < min(y):
  if xx>min_y or yy<max_x:
    print("War")
  else:
    print("No War")
else:
  print("War")

Submission status: Wrong Answer

Solution code:
N, M, X, Y = map(int, input().split(" "))
Xs = [int(a) for a in input().split()]
Ys = [int(a) for a in input().split()]
maxX = X
minY = Y
for i in Xs:
    if i>maxX:
        maxX = i

for i in Ys:
    if i<minY:
        min = i
        
if maxX < minY:
    print ("No War")
else:
    print ("War")

Submission status: Wrong Answer

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

flag = 0

x.sort()
y.sort()

if X >= Y:
    flag = 1
if x[n-1] >= y[0]:
    flag = 1

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

Submission status: Wrong Answer

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: Wrong Answer

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

x_ = list(map(int, input().split()))
y_ = list(map(int, input().split()))

max_x = max(x_)

if max_x < 0:
    max_y = min(y_)
else:
    max_y = max(y_)

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

Submission status: Wrong Answer

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.sort()
y.sort()

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

Submission status: Wrong Answer

Solution code:
N, M, X, Y = map(int, raw_input().split(' '))
Xs = sorted(map(int, raw_input().split(' ')))
Ys = sorted(map(int, raw_input().split(' ')))

if Xs + Ys == sorted(Xs + Ys) and min(Xs) < min(Ys) and max(Xs) < Y and X < min(Ys):
    print 'No War'
else:
    print 'War'

Submission status: Wrong Answer

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.sort()
y_list.sort()
if x_list[-1]+1 < y_list[0]:
  print("No War")
else:
  print("War")

Submission status: Wrong Answer

Solution code:
n,m,a,b=map(int, input().split())
x=list(map(int, input().split()))
y=list(map(int, input().split()))
j=False
for i in range(a+1,b+1):
    if i<max(x) and min(y)>=i:
        j=True

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, m, x, y = [int(s) for s in input().split()]
lx = [int(s) for s in input().split()]
ly = [int(s) for s in input().split()]
mx = max(lx)
my = min(ly)
print("No War" if mx < my else "War")

Submission status: Wrong Answer

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 X < y[0] and Y >= x[-1]:
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

Solution code:
N,M,X,Y=sorted(map(int, input().split()))
xi=sorted(map(int, input().split()))
yi=sorted(map(int, input().split()))
Zx = max(xi[-1],X)
Zy = min(yi[0],Y)
if Zx < Zy:
  print('No War')
else:
  print('War')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

if max(x)>min(y): print("War")
else: print("No War")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

N, M , X, Y = [int(i) for i in input().split(' ')]
xs = [int(i) for i in input().split(' ')]
ys = [int(i) for i in input().split(' ')]
mx = max(xs+[X])
my = min(ys+[Y])
if my >= mx:
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

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()
x.reverse()
y.sort()

if x[0] >= y[0]:
    print("War")
else:
    print("No War")

Submission status: Wrong Answer

Solution code:
n,m,x,y = map(int,input().split())	
a = list(map(int,input().split()))
b = list(map(int,input().split()))
k = 0
aa = max(a)
bb = min(b)

for i in range(x+1,y+1):
    if i >= aa and i <= bb:
        k = 1
if k == 0:
    print('War')
else:
    print('No War')

Submission status: Wrong Answer

Solution code:
import numpy as np
import math

# K = int(input())
# N, K = map(int, input().split())
# A = list(map(int, input().split()))

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)

if miny > maxx and maxx < Y and miny < X:
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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()
x.reverse()
y.sort()

if x[0] > y[0]:
    print("War")
else:
    print("No War")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if max(x)>min(y): print("War")
else: print("No War")

Submission status: Wrong Answer

Solution code:
from sys import stdin
n,m,x,y = map(int,stdin.readline().split())
ans = 'War'
a = map(int,stdin.readline().split())
b  = map(int,stdin.readline().split())
a.sort()
b.sort()
found = 0
for i in xrange(x,y+1):
 if max(a) < i and min(b) >= i:
  ans = 'No War'
print ans

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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) < min(y):
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

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):
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

Solution code:
n, m, x, y = map(int, input().split())
xxx = list(map(int, input().split()))
yyy = list(map(int, input().split()))
xxx.append(n)
yyy.append(m)
mx = max(xxx)
my = min(yyy)
print('No War' if mx < my else 'War')

Submission status: Wrong Answer

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("No War")
else:
    print("War")

Submission status: Wrong Answer

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) < min(Ys):
    print('No War')
else:
    print('War')

Submission status: Time Limit Exceeded

Solution code:
n,m,x,y = map(int,input().split())
xl = list(map(int,input().split()))
yl = list(map(int,input().split()))
xl.sort(reverse = True)
yl.sort()

if xl[0] < yl[0]:
    p = yl[0]
    while p > x:
        if x < p and p <= y:
            print('No War')
            exit(0)
    print('War')
else:
    print('War')

Submission status: Time Limit Exceeded

Solution code:
def bogosort(l):
  import random
  while 1:
    random.shuffle(l)
    for i in range(1,len(l)):
      if l[i]<l[i-1]:
        break
    else:
      return l
i=lambda:list(map(int,input().split()))
n,m,x,y=i()
if bogosort(i()+[x])[-1]<bogosort(i()+[y])[0]:
    print('No War')
else:
    print('War')

Submission status: Time Limit Exceeded

Solution code:
def bsort(l):
  import random
  while 1:
    random.shuffle(l)
    for i in range(1,len(l)):
      if l[i]<l[i-1]:
        break
    else:
      return l
i=lambda:list(map(int,input().split()))
n,m,x,y=i()
if bsort(i()+[x])[-1]<bsort(i()+[y])[0]:
    print('No War')
else:
    print('War')

Submission status: Time Limit Exceeded

Solution code:
def bogosort(l):
  import random
  while 1:
    random.shuffle(l)
    for i in range(1,len(l)):
      if l[i]<l[i-1]:
        break
    else:
      return l
i=lambda:list(map(int,input().split()))
n,m,x,y=i()
a=bogosort(i()+[x])
b=bogosort(i()+[y])
if a[-1]<b[0]:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
from typing import List


def answer(n: int, m: int, x: int, y: int, xs: List[int], ys: List[int]) -> str:
    xs.append(x)
    ys.append(y)
    if min(ys) <= max(xs):
        return 'War'
    return 'No War'


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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
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()]

ans="War"

for i in range(x+1, y+1):
    if max(x_list)<i<=min(y_list):
        ans="No War"
        break

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

for z in range(X+1, Y):
    if max(x) < z <= min(y):
        print('No War')
        exit(0)
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()))
z = [i for i in range(x+1,y+1)]
for i in range(len(z)):
  if max(xl) < z[i] <= min(yl):
    print("No War")
    exit()
print("War")

Submission status: Accepted

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

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

Z = [X+1, Y]

x.sort()
y.sort()

Z[0] = max(x[-1]+1, Z[0])
Z[1] = min(y[0], Z[1])

print("No War" if Z[0]<=Z[1] else "War")

Submission status: Accepted

Solution code:
def readinput():
    n,m,x,y=map(int,input().split())
    xx=list(map(int,input().split()))
    yy=list(map(int,input().split()))
    return n,m,x,y,xx,yy

def main(n,m,x,y,xx,yy):
    xx.append(x)
    yy.append(y)
    xx.sort()
    yy.sort()
    if xx[-1]<yy[0]:
        return 'No War'
    else:
        return 'War'

if __name__=='__main__':
    n,m,x,y,xx,yy=readinput()
    ans=main(n,m,x,y,xx,yy)
    print(ans)

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

Submission status: Accepted

Solution code:

url = "https://atcoder.jp//contests/abc110/tasks/abc110_b"

def main():
    n, m, x, y = list(map(int, input().split()))
    xs = list(map(int, input().split()))
    ys = list(map(int, input().split()))
    xs.sort()
    ys.sort()
    if xs[-1] >= ys[0]:
        print('War')
        exit()
    for i in range(xs[-1] + 1, ys[0] + 1):
        if x < i <= y:
            print('No War')
            exit()
    print('War')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,m,x,y = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
a.sort(reverse = True)
b.sort()
bool = False
if a[0] < b[0]:
    for i in range(a[0] + 1,b[0] + 1):
        if x < i and i <= y:
            bool = True
if bool:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
n, m, X, Y = map(int, input().split())
x = list(map(int, input().split())) + [X]
y = list(map(int, input().split())) + [Y]
if min(y)-max(x) >= 1:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
n, m, x, y = (int(i) for i in input().split())
list_x = sorted(list(map(int, input().split())))
list_y = sorted(list(map(int, input().split())))
if max(x ,list_x[-1]) < min(y, list_y[0]):
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
n,m,x,y = map(int,input().split())
a = max(list(map(int,input().split())))
b = min(list(map(int,input().split())))
ans = "War"
for i in range(x+1,y):
    if i>a and i<=b:
        ans = "No War"
print(ans)

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()))
if max(x_list)<min(y_list) and max(x_list)<y and x<min(y_list):
  print("No War")
else:
  print("War")

Submission status: Accepted

Solution code:
n,m,x,y = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
max_x = max(a)
min_y = min(b)
max_x = max(max_x,x)
min_y = min(min_y,y)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def mapt(fn, *args):
    return tuple(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def main():
    n, m, x, y = Input()
    x_data = Input()
    y_data = Input()
    x_max = max(x_data)
    y_min = min(y_data)
    ans = False

    for i in range(-100, 101):
        if x_max < i <= y_min and x < i <= y:
            ans = True
            break

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

Submission status: Accepted

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

for z in range(x+1,y+1):
  if max_x < z <= min_y:
    print("No War")
    exit()
else:
  print("War")

Submission status: Accepted

Solution code:
n,m,a,b = 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]:
    for i in range(x[-1]+1,y[0]+1):
        if a<i<b:
            print("No War")
            break
    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()))
sx = sorted(x)
sy = sorted(y)

if sx[-1] < sy[0] and X < sy[0] and sx[-1] < Y:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
import numpy as np

n, m, x, y = map(int, input().split())
px = np.array([int(i) for i in input().split()])
py = np.array([int(i) for i in input().split()])

res = 'War'
for i in range(x+1, y+1):
    if np.count_nonzero(px < i) == n and np.count_nonzero(py >= i) == m:
        res = 'No War'
        break
print(res)

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

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

print('War')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

left = max(a)
right = min(b)

if left < right and (x <= left < y or x < right <= y):
    print('No War')
else:
    print('War')

Submission status: Accepted

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

x_max = max(x_list)
y_min = min(y_list)

ans = "War"
for Z in range(X+1, Y+1):

    if x_max < Z <= y_min:
        ans = "No War"
        break

print(ans)