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())
s=list(map(int,input().split()))
t=list(map(int,input().split()))
c=0
max_x=max(s)
min_y=min(t)

for i in range(x+1,y+1):
    if i>max_x and i<=min_y:
        c+=1
if c>0:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
def resolve():
    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 z<=min(y):
            ans += 1
    print("No War" if ans != 0 else "War")
resolve()

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(xs)
y_=min(ys)
for z in range(x_+1,y_+1):
    if x<z<=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()))

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

Submission status: Accepted

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

x_n = list(map(int,input().split()))
y_m = list(map(int,input().split()))

x_n_max = max(x_n)
y_m_min = min(y_m)


if x > y:
    x_n_max = 1000000000000000000000

ans = 0
for z in range(x+1,y+1):
    if x_n_max < z and y_m_min >= z:
        print('No War')
        ans = -1
        break


if ans == 0:
    print('War')

Submission status: Accepted

Solution code:
import sys, re
from math import ceil, floor, sqrt, pi, factorial#, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    n, m, x, y = i_map()
    x_list = i_list()
    y_list = i_list()

    x_list.sort()
    y_list.sort()

    for i in range(x+1,y+1):
        if x_list[n-1] < i and i <= y_list[0]:
            print('No War')
            exit()

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

if min(Y) <= max(X):
  print("War")
  exit()
else:
  for i in range(max(X)+1, min(Y)+1):
    if x < i <= 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()))

a, b = max(x), min(y)
for val in range(X+1, Y):
  if a < val <= b:
    print("No War")
    exit(0)
print("War")

Submission status: Accepted

Solution code:
n,m,x,y=[int(_) for _ in input().split()]
X=[int(_) for _ in input().split()]
Y=[int(_) for _ in input().split()]

ans="No War"
if max(X)>=min(Y):
  ans="War"
if not(x<=max(X)<y):
  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()))
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()))
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())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
if min(y)<=X:
  print("War")
elif Y<=max(x):
  print("War")
else:
  if max(x)>=min(y):
    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()))+[X]
y=list(map(int, input().split()))+[Y]
if max(x)<min(y):
    print("No War")
else:
    print("War")

Submission status: Accepted

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

xmax = max(x)
ymin = min(y)
if xmax >= ymin:
    print("War")
else:
    for z in range(xmax+1, ymin+1):
        if X < z <= Y:
            print("No War")
            break
    else:
        print("War")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

# https://atcoder.jp/contests/abc110


def main():
    N, M, X, Y = map(int, input().split())
    x = list(map(int, input().split()))
    y = list(map(int, input().split()))
    x = sorted(x)
    y = sorted(y)

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

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


print(main())

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()))
if x < y:
    for i in range(x+1, y+1):
        if max(xx) < i and min(yy) >= i:
            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())
xt=list(map(int,input().split()))
yt=list(map(int,input().split()))
xt.sort()
yt.sort()
if max(x,xt[len(xt)-1])<min(y,yt[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()))

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 = [int(i) for i in input().split()]
x.append(X)
y = [int(i) for i in input().split()]
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()))
x.sort()
y.sort()
x_max = x[-1]
y_min = y[0]
if max(X, x_max) < min(Y, y_min):
    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())))

z = X[-1] + 1
if z <= Y[0] and x < z <= y:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
# B - 1 Dimensional World's Tale

N, M, X, Y = map(int, input().split())
x = list(int(x) for x in input().split())
y = list(int(y) for y in input().split())

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

if x_max < y_min:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
N,M,X,Y = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
Xmax = max(A)
Ymin = min(B)
out = "War"
Xmax = max(Xmax,X)
Ymin = min(Ymin,Y)
if Xmax<Ymin:
    out = "No War"
print(out)

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
x = max(list(map(int, input().split())))
y = min(list(map(int, input().split())))
if y - x > 0:
  if X < x < Y or X < y <= Y:
  	print('No War')
  else:
    print('War')
else:
  print('War')

Submission status: Accepted

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

max_x = max(x + [X])
min_y = min(y + [Y])

print("War" if max_x >= min_y else "No 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()))
flagx, flagy, flagz = 0, 0,0
z = 0
for i in range(x+1,y+1):
    for j in range(n):
        if i <= xi[j]:
            flagx = 1
            break
    for k in range(m):
        if i > yi[k]:
            flagy = 1
            break
    if flagx == 0 and flagy == 0:
        flagz =1
        break
    flagx, flagy = 0, 0
if flagz == 0:
    print('War')
else:
    print('No 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())))
ans='War'
for i in range(X+1,Y+1):
    if x[-1]<i and y[0]>=i:
        ans='No War'
        break
print(ans)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def resolve():
	n, m, x, y = map(int, input().split())
	xp = list(map(int, input().split()))
	yp = list(map(int, input().split()))
	for i in range(-99, y+1):
		ok = True
		if i <= x or i > y:
			continue
		for cx in xp:
			if cx >= i:
				ok = False
				break
		for cy in yp:
			if cy < i:
				ok = False
				break
		if ok:
			print('No War')
			return
	print('War')
resolve()

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

Submission status: Accepted

Solution code:
def examA():
    A = LI()
    A.sort()
    ans = A[2]*10+A[1]+A[0]
    print(ans)
    return

def examB():
    N, M, x, y = LI()
    X = LI()
    Y = LI()
    X.sort(); Y.sort()
    if max(X[-1],x)<min(Y[0],y):
        print("No War")
    else:
        print("War")
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examB()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().split())
xx=[int(i) for i in input().split()]
yy=[int(i) for i in input().split()]
ok=False
for i in range(x+1,y+1):
    ansx=[0 if j<i else 1 for j in xx]
    ansy=[0 if j>=i else 1 for j in yy]
    if 1 not in ansx and 1 not in ansy:
        ok=True
        break
if ok:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
# input
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())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
z1 = max(A)+1
z2 = min(B)
for i in range(x+1,y+1):
    if z1 <= i <= z2:
        print("No War")
        break
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 i in range(x + 1, y + 1):
    if max(X) < i and min(Y) >= i:
        print("No War")
        exit()
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()))

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

for Z in range(X+1,Y+1):
    if x_max < Z <= y_min:
        print('No War')
        break

else:
    print('War')

Submission status: Accepted

Solution code:
N,M,X,Y=map(int,input().split())
x=sorted([X]+list(map(int,input().split())))
y=sorted([Y]+list(map(int,input().split())))
if x[-1]<y[0]:
  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()))
ans = 'War'
for z in range(max(xs) + 1, min(ys) + 1):
    if x < z <= y:
        ans = 'No War'
        break
print(ans)

Submission status: Accepted

Solution code:
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

N, M, X, Y = map(int, input().split())
XS = list(map(int, input().split())) + [X]
YS = list(map(int, input().split())) + [Y]

print("No War" if max(XS) < min(YS) 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()))
x1=max(x)
y1=min(y)
for i in range(X+1,Y+1):
    if x1<i and y1>=i:
        print('No War')
        exit()
print('War')

Submission status: Accepted

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

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

y = list(map(int,input().split()))
y = min(y)
i = x
ans = ''


for i in range(a+1,b):
  # X<z<yという区間を満たしていない ので誤りその条件を付け加えるなら...
  if x<i and i<=y:
    ans = 1
if ans:
  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 max(X,x[N-1]) < min(Y,y[0]):
    print("No War")
else:
    print("War")

Submission status: Accepted

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 min(ymin, y) - max(xmax, x) >= 1:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
n,m,x,y = map(int,input().split())
x_max = max(list(map(int,input().split())))
y_min = min(list(map(int,input().split())))
if x_max+1<=y_min:
    if x_max+1>x and x_max+1<=y:
        print('No War')
    else:
        print('War')
else:
    print('War')

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()]
ans=False
for z in range(X+1,Y+1):
    if max(x)<z<=min(y):
        ans=True

if ans==True:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().split())
ans=0
a=list(map(int,input().split()))
b=list(map(int,input().split()))
for i in range(x+1,y+1):
    if max(a)<i<=min(b) and x<i<=y:
        ans+=1
if ans>=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()))

x.sort()
y.sort()
ans = "War"

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

print(ans)

Submission status: Accepted

Solution code:
n, m, x, y = map(int, input().split())
if x>y :
    print('War')
else  :
    X = sorted(list(map(int, input().split())))
    Y = sorted(list(map(int, input().split())))
    a = 0
    for i in range(x+1, y+1):
        if X[-1]<i and i <= Y[0] and x < i and i <= y:
            print('No War')
            break
        else :
            a += 1
    if a == y-x:
        print('War')

Submission status: Accepted

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

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

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
import bisect
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def Yes(): print("Yes"); return
def No(): print("No"); return

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#############
# Main Code #
#############

N,M,X,Y = inputIL()
x = inputIL()+[X]
y = inputIL()+[Y]

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

Submission status: Accepted

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

x = max(x)
y = min(y)

flag = True
for z in range(-100, 100+1):
    if x < z <= y and X < z <= Y:
        flag = False
        
if flag:
    print('War')
else:
    print('No War')

Submission status: Accepted

Solution code:
n, m, x_capital, y_capital = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
ans = "War"

for i in range(100):
    if x_capital < i and i <= y_capital and max(x) < i and i <= min(y):
        ans = "No War"

print(ans)

Submission status: Accepted

Solution code:
import sys
import math
import numpy as np
import copy

def main():
    n, m, nx, ny = map(int, input().split())
    x = [int(t) for t in input().split()]
    y = [int(t) for t in input().split()]
    x.sort()
    y.sort()
    if x[-1] < y[0] and y[0] > nx and x[-1] < ny:
        print("No War")
    else:
        print("War")

    return 0

if __name__ == '__main__':
    sys.exit(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()))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = 10**18
# ----------------------------------------------------------- #

n, m, x, y = Is()
X = LI() + [x]
Y = LI() + [y]
X.sort()
Y.sort()
if X[-1] < 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()))
x.sort()
y.sort()
flag = False
if x[-1] < y[0]:
    for i in range(x[-1], y[0]+1):
        if i == x[-1]:
            if X <= i < Y:
                flag = True
                break
        elif i == y[0]:
            if X < i <= Y:
                flag = True
                break
        else:
            if X < i < Y:
                flag = True
                break
if flag:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
N,M,X,Y=map(int,input().split())
XL=sorted(list(map(int,input().split())))
YL=sorted(list(map(int,input().split())))
ans = 'War'

for Z in range(X+1,Y+1):
    if XL[-1]<Z and Z<=YL[0]:
        ans = 'No War'
        break

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()))
ans = "War"
am = max(a)
bm = min(b)
for z in range(x+1,y+1):
    if am<z and bm>=z:
        ans = "No War"
        break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,m,x,y = map(int,input().split())
x_list = list(map(int,input().split()))
x_max = max(x_list)
y_list = list(map(int,input().split()))
y_min = min(y_list)
ans = "War"
for i in range(x+1,y+1):
    if x_max < i <= y_min:
        ans = "No War"
        break
print(ans)

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

d=min(y)-max(x)
warFlag = False
if d<=0:
    print("War")
    sys.exit()
else:
    for i in range(1, Y - X + 1):
        Z=X+i
        if (max(x)>=Z or min(y)<Z):
          warFlag = True
        else: #max(x) < Z, max(y) >= Z
          warFlag = False
          break
if warFlag:
  print("War")
else:
  print("No 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 z in range(x + 1, y + 1):
    if max(a) < z <= min(b):
        print("No War")
        exit()
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)

X.sort()
Y.sort()

print('War' if max(X) >= min(Y) else 'No War')

Submission status: Accepted

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

zx = max(x[-1], xx)
zy = min(y[0], yy)

if yy == x[-1]:
    print('War')
    exit()
if xx == y[0]:
    print('War')
    exit()
if x[-1] == y[0]:
    print('War')
    exit()
if zx > zy:
    print('War')
    exit()

print('No War')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
inf = 10**15
mod = 10**9+7
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 and xmax < y and ymin > x:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    def main():
        n,m,x,y=map(int, input().split())
        lx=list(map(int,input().split()))
        ly=list(map(int,input().split()))
        xmax=max(lx)
        ymin=min(ly)
        for i in range(x+1,y+1):
            if xmax<i and ymin >=i:
                return 'No War'
        return 'War'
    print(main())
resolve()

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

Submission status: Accepted

Solution code:
n,m,X,Y=map(int,input().split())
x=list(map(int,input().split()))+[X]
y=list(map(int,input().split()))+[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()))

xl=max(X)
ys=min(Y)

for z in range(x+1,y+1):
	if xl<z<=ys:
		print("No War")
		break
else:
	print("War")