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: Runtime Error

Solution code:

array = list(map(int, input().split()))
#array.sort(reverse = True)
N = array[0]
M = array[1]
X = array[2]
Y = array[3]

xarray = list(map(int, input().split())+X)
xarray.sort(reverse = True)
##print(xarray)
xmax = xarray[0]

yarray = list(map(int, input().split())+Y)
yarray.sort()
##print(yarray)
ymin = yarray[0]

if (ymin > xmax):
    print("No War")
else:
    print("War")
##print(array)

Submission status: Runtime Error

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):
        print(z)
        if z > X and z =< Y:
            flag = True
            break

else:
    flag = False

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

Submission status: Runtime Error

Solution code:
set_num = input()
x_n = input()
y_m = input()

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

x_max = max(x_n)
y_min = min(y_m)

for i in range(x_max,101):
    if x_max < i and y_min >= 16:
        print("No War")
    
print("War")

Submission status: Runtime Error

Solution code:
set_num = input()
x_n = input()
y_m = input()

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

x_max = max(x_n)
y_min = min(y_m)
i = x_max

for i in range(1,101):
    if x_max < i and y_min >= 16:
        print("No War")
    
print("War")

Submission status: Runtime Error

Solution code:
a, b, c, d = map(int, input().split())
if a>0:
    print(No War)
else:
    print(War)

Submission status: Runtime Error

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

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

x.sort()
x.reverse()
y.sort()

c = 0

for Z in range(x[0]+1, y[0]+1):
    if (X < Z) and (Z <= Y) and (x[0] < Z) and (y[0] >= Z):
        print("No War")
        c = 1
        break
        
if c = 0:
    print("War")

Submission status: Runtime Error

Solution code:
N, M, X, Y = (int(i) for i in input().split())
C = []
for i in range(N):
    C.append(input())
D = []
for i in range(M):
    D.append(input())


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

if x < y:
    A = 1
elif x >= y:
    A = 0

if X < (x + y) / 2 <= Y:
    B = 1
else:
    B = 0

if A == 1 and B == 1:
    print('No War')
else:
    print('War')

Submission status: Runtime Error

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

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

x.sort()
x.reverse()
y.sort()

print(x)
print(y)

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

Submission status: Runtime Error

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

XL.sort()
YL.sort()

for z range(X+1,Y+1):
	if z>XL[N-1] and z<=YL[0]:
		count = 1 

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

Submission status: Runtime Error

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: Runtime Error

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

S = set(L_X, )
S.add(L_Y, )
if X in S or Y in S:
    print("War")
elif max(L_X) < min(L_Y) and X < min(L_Y) and max(L_X) < Y:
    print("No War")
else:
    print("War")

Submission status: Runtime Error

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: Runtime Error

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

Submission status: Runtime Error

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 data_x.count(Y) ~= 0:
    print('War')
elif data_y.count(X) ~= 0:
    print('War')
else:
    print('No War')

Submission status: Runtime Error

Solution code:
head=[int(n) for n in input.readline().split()]
list_x=[int(n) for n in input.readline().split()]
list_x.append(head[2])
list_y=[int(n) for n in input.readline().split()]
if max(list_x) < min(list_y):
    print("No War")
else:
    print("War")

Submission status: Runtime Error

Solution code:
import sys

n,m,x,y = (int(_) for _ in input().split())
xl = [int(_) for _ in input().split()]
yl = [int(_) for _ in input().split()]

xl.sort()
yl.sort()

for i in range(x+1,y+1):
    if((x < int(i) <= y) and (x[-1] < int(i)) and (y[0] >= int(i))):
        print('No War')
        sys.exit()
    else:
        pass

print('War')

Submission status: Runtime Error

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

a=x_max+1
b=y_min

def judge(a,b):
    if(a>b):
        return print("No War")
    else:
        z=range(a,b+1)
        for i in z:
            if(i>X and i<=Y):
                return print("No War")
        else:
            return print("War")
        
judge(a,b)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, m, x, y = map(int, input().split())
a = [*map(int, input().split())]
b = [*map(int, input().split())]
print('No War' if any(x < i <= y for i in \
	range(max(a) + 1, min(b) + 1)) else 'War')

Submission status: Runtime Error

Solution code:
l = input().split(" ")
n= int(l[0])
m= int(l[1])
x= int(l[2])
y= int(l[3])
xcon=[]
ycon= []
if x > y:
    print("War")
else:
    xcon = input().split(" ")
    for i in range(n-1):
        xcon[i] = int(xcon[i])
    ycon = input().split(" ")
    for i in range(m-1):
        ycon[i]=int(ycon[i])
    xcon = sorted(xcon)
    ycon = sorted(ycon)
    if x <= xcon[n] <ycon[0] <=  y :
        print("No war")
    else:
        print("War")

Submission status: Runtime Error

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

for Z in range(X. Y+1):
    if max(x) < Z and Z <= min(y):
        flg = 1
if flg == 1:
    print("No War")
else:
    print("War")

Submission status: Runtime Error

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

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

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

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

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

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
5 3 6 8
-10 3 1 5 -100
100 6 14

Submission status: Runtime Error

Solution code:
l = input().split(" ")
n= int(l[0])
m= int(l[1])
x= int(l[2])
y= int(l[3])
xcon=[]
ycon[]
if x > y:
    print("War")
else:
    for i in range(n):
        xcon.append(int(input()))
    for i in range(m):
        ycon.append(int(input()))
    xcon = sorted(xcon)
    ycon = sorted(ycon)
    if x <= xcon[n] <ycon[0] <=  y :
        print("No war")
    else:
        print("War")

Submission status: Runtime Error

Solution code:
NMXY =  list(int(i) for i in input().split())
xy =  [[int(i) for i in input().split()] for i in range(NMAB[1])]

x = xy[0]
x.append(NMXY[2])
y = xy[1]
y.append(NMXY[3])
print(max(x))
print(min(y))
if max(x) < min(y):
    print('No War')
else:
    print('War')

Submission status: Runtime Error

Solution code:

NMAB =  list(int(i) for i in input().split())
xy =  [[int(i) for i in input().split()] for i in range(NMAB[1])]

x = xy[0]
x.append(NMXY[2])
y = xy[1]
y.append(NMXY[3])
print(max(x))
print(min(y))
if max(x) < min(y):
    print('No War')
else:
    print('War')

Submission status: Runtime Error

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

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

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

xs_max = max(xs)
ys_min = min(ys)
flag = True
for xi in range(xs+1, ys_min):
  if x<xi and xi<=y:
    print('No War')
    flag = False
    break
if flag:
  print('War')

Submission status: Runtime Error

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