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:
#!/usr/bin/env python3

import sys
# import math
# from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)


def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1               # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    n, m, x, y = mi()
    X = lmi()
    Y = lmi()
    if max(X) < min(Y):
        for p in range(max(X) + 1, min(Y) + 1):
            if x < p <= y:
                print('No War')
                exit()
    print('War')

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N, M, X, Y = list(map(int,input().split()))
x = list(map(int,input().split()))
y = list(map(int,input().split()))
x_max = max(x)
y_min = min(y)
ans = 'War'
for i in range(-100,101):
    if (X < i <= Y ) and (x_max < i <= y_min):
        ans = 'No War'
print(ans)

Submission status: Accepted

Solution code:
import sys

N, M, X, Y = map(int, input().split())
X_lis = list(input().split())
X_lis = [int(X_lis[i]) for i in range(N)]
Y_lis = list(input().split())
Y_lis = [int(Y_lis[i]) for i in range(M)]

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

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().split())
xx=list(map(int,input().split()))
yy=list(map(int,input().split()))
xx.append(x)
yy.append(y)
xx.sort()
yy.sort()
if xx[-1]<yy[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 = sorted(x)
y = sorted(y)
ok = False
for i in range(X+1,Y+1):
    if x[n-1] < i and y[0] >= i:
        ok = True
        break
if ok == 1: print("No War")
else: print("War")

Submission status: Accepted

Solution code:
n, m, x, y = map(int, input().split())
xn = [int(i) for i in input().split()]
ym = [int(i) for i in input().split()]
if max(xn) >= y:
    print("War")
elif min(ym) <= x:
    print("War")
elif max(xn) >= min(ym):
    print("War")
else:
    print("No War")

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

found = False
for Z in range(X+1, Y+1):
    if max(X_list) < Z and min(Y_list) >= Z:
        found = True
        print("No War")
        break
if not found:
    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()] + [x]
y_list = [int(i) for i in input().split()] + [y]
print("No War" if max(x_list) < min(y_list) else "War")

Submission status: Accepted

Solution code:
n,m,x,y = map(int,input().split())
xi = list(map(int,input().split()))
xi.append(x)
yi=  list(map(int,input().split()))
yi.append(y)
if  max(xi)<min(yi):
    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()))
flag = False
for i in range(X+1,Y+1):
    if max(x) < i and min(y) >= i:
        flag = True
        break
if flag:
    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()))

xx = max(xs)
yy = min(ys)

for i in range(x+1,y+1):
  if xx < i <= yy:
    print('No War')
    break
else:
  print('War')

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, M, X, Y = lr()
x = lr(); x.append(X)
x.sort()
y = lr(); y.append(Y)
y.sort()
bl = y[0] > x[-1]
print('No War' if bl else 'War')

Submission status: Accepted

Solution code:
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi
# endregion

N, M, X, Y = ri_()
x = ri_()
y = ri_()
ans = 'War'
for Z in range(-100, 101):
    if X < Z <= Y and max(x) < Z and min(y) >= Z:
        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()))

flag = False

for i in range(X + 1, Y + 1):
  if max(x) < i <= min(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())
X_list = list(map(int, input().split()))
Y_list = list(map(int, input().split()))
X_list.append(X)
Y_list.append(Y)
if max(X_list) < min(Y_list):
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
n, m, x, y = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.append(x)
b.append(y)
if max(a) < min(b):
  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()))
y_list = list(map(int,input().split()))
x_list.append(x)
y_list.append(y)
if max(x_list) < min(y_list):
  print('No War')
else:
  print('War')

Submission status: Accepted

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

x_max = max(xl)
y_min = min(yl)
for z in range(x+1, y+1):
    if x_max < z <= y_min:
        print('No War')
        exit()

print('War')

Submission status: Accepted

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

x.sort(reverse=True)
xmax = max(x[0], X)
y.sort()
ymin = min(y[0], Y)

if ymin - xmax > 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(reverse=True)
xmax = max(x[0], X)
y.sort()
ymin = min(y[0], Y)

if ymin - xmax > int(0):
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
import sys
N,M,X,Y=[int(x) for x in input().rstrip().split()]
x_n=[int(x) for x in input().rstrip().split()]
y_m=[int(x) for x in input().rstrip().split()]
x_max=max(x_n)
y_max=min(y_m)
for z in range(X+1,Y+1):
  if x_max<z and z<=y_max:
    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(x) < min(y) and X < min(y) and min(y) <= Y:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n, m, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
max_x = max(x)
min_y = min(y)
for i in range(X + 1, Y):
    if i > max_x and i <= min_y:
        print("No War")
        exit()
print("War")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
from copy import deepcopy
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
inf = 10**17
mod = 10**9 + 7

n,m,x,y=MI()
X=LI()
Y=LI()
X=sorted(X,reverse=True)
Y=sorted(Y)
if X[0]<Y[0] and X[0]<y and Y[0]>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()))
Z = []
Z_x = []
f_y = False
for i in range(X+1, Y+1):
    Z.append(i)  #X < Z <= Yをappend

###Zの範囲で条件を満たすZのみZ_xにappend
for i in range(len(Z)):
    cnt_x = 0
    for j in range(len(x)):
        if Z[i] > x[j]:
            cnt_x += 1
    if cnt_x == len(x):
        Z_x.append(Z[i])

###条件を満たし、新たにできたZの範囲で条件を満たすYを探す
for i in range(len(Z_x)):
    cnt_y = 0
    for j in range(len(y)):
        if Z_x[i] <= y[j]:
            cnt_y += 1
    if cnt_y == len(y):
        f_y = True
        break

if f_y:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
if y-x>=1:
  kouho=[]
  for k in range(x+1,y+1):
    kouho.append(k)
  p.sort()
  q.sort()
  c=0
  for i in range(0,len(kouho)):
    c+=1
    if p[-1]<kouho[i]<=q[0]:
      print("No War")
      break
    if c==len(kouho):
      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()))
jdg = False
if max(x) < min(y):
    if min(y)>X and max(x)<Y:jdg=True

print('No War' if jdg else 'War')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
try:
    from typing import List
except ImportError:
    pass


def solve(N: int, M: int, X: int, Y: int, x: "List[int]", y: "List[int]"):
    xs = set(x)
    xs.add(X)
    ys = set(y)
    ys.add(Y)
    x1 = min(xs)
    x2 = max(xs)
    y1 = min(ys)
    y2 = max(ys)
    print("No War" if (x2 < y1 or y2 < x1) else "War")


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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

xl=list(map(int,input().split()))
yl=list(map(int,input().split()))

xl.append(x)
yl.append(y)

if max(xl) < min(yl):
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
#n=int(input())
n,m,x,y=map(int,input().split())
xl=list(map(int,input().split()))
yl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

ans="War"

for z in range(x+1,y+1,1):
    if max(xl)<z and min(yl)>=z:
        ans="No War"
        break

print(ans)

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

if max(xi)<min(yi) and x<min(yi)<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]
y = [int(i) for i in input().split()] + [Y]
if max(x) < min(y):
    print('No War')
else:
    print('War')

Submission status: Accepted

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

m_x = sorted(x,reverse=True)
m_y = sorted(y)

ans = "War"

for i in range(m_x[0]+1,m_y[0]+1):
    if X<i<=Y:
        ans = "No War"


print(ans)

Submission status: Accepted

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

m_x = sorted(x,reverse=True)
m_y = sorted(y)

ans = "War"

for i in range(X+1,Y+1):
    if m_x[0]<i<=m_y[0]:
        ans = "No War"
 
print(ans)

Submission status: Accepted

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

def main():
    _, _, X, Y = map(int, input().split())
    max_x = max(map(int, input().split() + [X]))
    min_y = min(map(int, input().split() + [Y]))

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

ans = 'War'

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

ans = 'War'

for z in range(X+1, Y+1):
    if len(list(filter(lambda x: x < z, x))) == N and len(list(filter(lambda x: x >= z, y))) == M:
        ans = 'No War'
        break

print(ans)

Submission status: Accepted

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

for Z in range(X+1, Y+1):
  if all([i < Z for i in x]) and all([i >= Z for i in y]):
    print('No War')
    exit()

print('War')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
MOD = 10 ** 9 + 7
INF = 10 ** 10
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)

def main():
    n,m,x,y = map(int,input().split())
    X = list(map(int,input().split()))
    Y = list(map(int,input().split()))
    t = max(X)
    s = min(Y)
    if max(t,x) < min(s,y):
        print('No War')
    else:
        print('War')
if __name__ == '__main__':
    main()

Submission status: Accepted

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

XN.sort()
YM.sort()

print("No War" if max(X,XN[N-1]) < min(Y,YM[0]) else"War")

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())))
print("No War" if any([X<z<=Y for z in range(x+1,y+1)]) else "War")

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

Submission status: Accepted

Solution code:
"""MILOY"""
n,m,x,y=list(map(int,input().split()))
line1=list(map(int,input().split()))
line2=list(map(int,input().split()))
t=0
try:
    for i in range(x+1,y+1):
        c=0
        s=0
        for j in line1:
            if (i<=j):
                c+=1
            
        for j in line2:
            if(i>j):
                s+=1
              
        if ( c==0 and s==0):
            t=t+1
           
    
    if(t==0):
        print('War')
    if(t!=0):
        print('No War')
        
except:
    print('War')

Submission status: Accepted

Solution code:
n,m,x,y=list(map(int,input().split()))
line1=list(map(int,input().split()))
line2=list(map(int,input().split()))
t=0
try:
    for i in range(x+1,y+1):
        c=0
        s=0
        for j in line1:
            if (i<=j):
                c+=1
            
        for j in line2:
            if(i>j):
                s+=1
              
        if ( c==0 and s==0):
            t=t+1
           
    
    if(t==0):
        print('War')
    if(t!=0):
        print('No War')
        
except:
    print('War')

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M, X, Y = MAP()
x = LIST()
y = LIST()
for i in range(max(x)+1, min(y)+1):
	if X < i <= Y:
		print("No War")
		break

else:
	print("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()))
x_max = max(listx)
y_min = min(listy)
z_list = [i for i in  range(-100,101,1) if X<i and i<= Y]
z_list1 = [1 for z in z_list if x_max < z and y_min>= z]
if len(z_list1)>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()))
if (max(x)<min(y) and X<min(y) and max(x)<Y):
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().split())
X= list(map(int,input().split()))
Y= list(map(int,input().split()))
maxx = max(X)
miny = min(Y)
frag = 0
for i in range(x+1,y+1):
    if i >maxx and i <=miny :
        frag = 1
        break
if frag == 1:
    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()))
a.append(x)
b.append(y)
a.sort()
b.sort()
if a[-1]>=b[0]:
  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.append(x)
Y.append(y)
X.sort()
Y.sort()

for i in range(-100,100):
    if X[-1] < i <= Y[0]:
        print("No War")
        exit()

print("War")

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

print(ans)

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 x >= y or X >= y or X >= Y or Y <= x:
    ans = "War"
else:
    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()))

ans = "War"

for z in range(x+1, y+1):
    if(max(X) < z & z <= min(Y)):
        ans = "No War"

print(ans)

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[n-1] < y[0] and X < y[0] and x[n-1] < 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()))
if max([X,max(Xs)]) < min([Y,min(Ys)]):
  print("No War")
else:
  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()))
xl.sort()
yl.sort()
ans = False
if x < y and x < xl[n - 1] < yl[0] < y:
    ans = True
    
print("No War" if ans else "War")

Submission status: Accepted

Solution code:
import sys
from collections import deque

sys.setrecursionlimit(10 ** 6)


def input(): return sys.stdin.readline().rstrip()

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

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

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
x = [int(x) for x in input().split()]
y = [int(y) for y in input().split()]
x.append(X)
y.append(Y)

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 6)

def main():
    N, M, X, Y = map(int, sys.stdin.readline().rstrip().split())
    x = list(map(int, sys.stdin.readline().rstrip().split()))
    x = max(X, max(x))
    y = list(map(int, sys.stdin.readline().rstrip().split()))
    y = min(Y, min(y))
    if x < y:
        print('No War')
    else:
        print('War')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

max_x = max(X, max(cities_x))
min_y = min(Y, min(cities_y))

if min_y - max_x >= 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()))

def check(x,y,X,Y):
    # print(x,y)
    x.append(X)
    y.append(Y)
    # print(x,y)
    if min(y)>max(x):
        return True
    return False
if check(x,y,X,Y):
    print('No War')
else:
    print('War')

Submission status: Accepted

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

xx.sort()
yy.sort()
for i in range(x+1,y+1):
    if xx[-1] < i and yy[0] >= i:
        print('No War')
        quit()
print('War')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

def main(lines):
  N, M, X, Y = map(int, lines[0].split()) 
  x = list(map(int, lines[1].split()))
  y = list(map(int, lines[2].split()))
  x.sort()
  y.sort()
  flag = 0
  for i in range(X + 1, Y + 1):
    if x[N - 1] < i and i <= y[0]:
      flag = 1
  if flag:
    print("No War")
  else:
    print("War")


if __name__ == '__main__':
    lines = []
    for l in sys.stdin:
        lines.append(l.rstrip('\r\n'))
    main(lines)

Submission status: Accepted

Solution code:
n,m,X,Y=map(int,input().split())
x=[0]*n
y=[0]*m
x=list(map(int,input().split()))
y=list(map(int,input().split()))
left=max(x)
right=min(y)
#print(left,right)
for i in range(X+1,Y+1):
  if (left<i<=right):
    print("No War")
    break
else:
  print("War")

Submission status: Accepted

Solution code:
# ABC 110: B – 1 Dimensional World's Tale
n, m, x, y = [int(s) for s in input().split()]
wants_x = [int(s) for s in input().split()]
wants_y = [int(s) for s in input().split()]

wants_x.append(x)
wants_x.sort()

wants_y.append(y)
wants_y.sort()

print('War' if x >= y or max(wants_x) >= min(wants_y) else 'No War')

Submission status: Accepted

Solution code:
def main():
    N, M, X, Y = map(int, input().split())
    xlist = [int(a) for a in input().split()]
    ylist = [int(a) for a in input().split()]
    xlist.sort()
    ylist.sort()
    if X < ylist[0] <= Y and xlist[-1] < ylist[0]:
        print("No War")
    else:
        print("War")
main()

Submission status: Accepted

Solution code:
# solution
import io

n, m, q, r = map(int, input().split())
highest = max(list(map(int, input().split())))
lowest = min(list(map(int, input().split())))
print('War' if highest >= lowest or r <= highest or q >= lowest else 'No War')

Submission status: Accepted

Solution code:
n, m, a, b = map(int, input().split())
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
x.sort()
y.sort()



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

print("War")

Submission status: Accepted

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

X_city.append(X)
Y_city.append(Y)

if max(X_city) < min(Y_city) :
  print("No War")
else :
  print("War")

Submission status: Accepted

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

X_city.append(X)
Y_city.append(Y)

if max(X_city) < min(Y_city) or min(X_city) > max(Y_city) :
  print("No War")
else :
  print("War")