Problem:


Score : 200 points

Problem Statement

Our world is one-dimensional, and ruled by two empires called Empire A and Empire B.

The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.

One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.

If there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.

X < Z \leq Y

x_1, x_2, ..., x_N < Z

y_1, y_2, ..., y_M \geq Z

Determine if war will break out.

Constraints

All values in input are integers.

1 \leq N, M \leq 100

-100 \leq X < Y \leq 100

-100 \leq x_i, y_i \leq 100

x_1, x_2, ..., x_N \neq X

x_i are all different.

y_1, y_2, ..., y_M \neq Y

y_i are all different.

Input

Input is given from Standard Input in the following format:

N M X Y
x_1 x_2 ... x_N
y_1 y_2 ... y_M

Output

If war will break out, print War; otherwise, print No War.

Sample Input 1

3 2 10 20
8 15 13
16 22

Sample Output 1

No War

The choice Z = 16 satisfies all of the three conditions as follows, thus they will come to an agreement.

X = 10 < 16 \leq 20 = Y

8, 15, 13 < 16

16, 22 \geq 16

Sample Input 2

4 2 -48 -1
-20 -35 -91 -23
-22 66

Sample Output 2

War

Sample Input 3

5 3 6 8
-10 3 1 5 -100
100 6 14

Sample Output 3

War



Sample input:
3 2 10 20
8 15 13
16 22


Sample output:
No War

Submission status: Accepted

Solution code:
n, m, x, y = map(int, input().split())
x_list = list(map(int, input().split()))
y_list = list(map(int, input().split()))
flag = False
if max(x_list) < min(y_list):
    flag = True
if flag:
    for i in range(max(x_list) + 1, min(y_list) + 1):
        if x < i <= y:
            flag = True
            break
        else:
            flag = False
if flag:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    N, M, XX, YY = map(int, input().split())
    X = list(map(int, input().split()))
    Y = list(map(int, input().split()))
    X.append(XX)
    Y.append(YY)
    if max(X) < min(Y):
        print("No War")
    else:
        print("War")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
n, m, x, y = M()
xlist = LI()
ylist = LI()
ans = 'War'
for i in range(-100, 101):
    if x < i and y >= i and max(xlist) < i and min(ylist) >= i:
        ans = 'No War'
        break
print(ans)

Submission status: Accepted

Solution code:
import sys
from collections import deque
mapin = lambda: map(int, sys.stdin.readline().split())
listin = lambda: list(map(int, sys.stdin.readline().split()))
inp = lambda: sys.stdin.readline()

N,M,X,Y = mapin()
veca = listin()
vecb = listin()
max_x = -10000
min_y = 10000
for i in veca:
    if max_x < i:max_x = i
for i in vecb:
    if min_y > i:min_y = i
if max_x < min_y and max_x > X and min_y < 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,X,Y = map(int,input().split())
x_lis = list(map(int,input().split()))
y_lis = list(map(int,input().split()))

x_max = max(x_lis)
y_min = min(y_lis)

ans = "War"
for Z in range(X+1,Y+1):
  if x_max < Z <= y_min:
    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()))
if X < min(y) <= Y and 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()))
x = sorted(x, reverse=False)[-1]
y = sorted(y, reverse=False)[0]
flg = 'War'
if x < x+1 <= y:
    if x+1 > X:
        if x+1 <= Y:
            flg = 'No War'

print(flg)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


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

    def judge():
        for Z in range(X + 1, Y + 1):
            if all(p < Z for p in x) and all(p >= Z for p in y):
                return True
        return False

    if judge():
        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()))

Mx = max(x)
My = min(y)

if Mx >= My or Mx >= Y or X >= My:
  print("War")
else:
  print("No War")

Submission status: Accepted

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

x_max = max(x)
y_min = min(y)
flag = False
for z in range(X+1,Y+1):
  if x_max < z <= y_min:
    flag = True
print("No War" if flag 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.sort()
y.sort()
if x[n - 1] < Y and X < y[0] and x[n - 1] < y[0]:
    print('No War')
else:
    print('War')

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(x + 1, y + 1):
  if all(j < i for j in a) and all(k >= i for k in b):
    print("No War")
    break
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()))

if max(xl) < min(yl) and x < min(yl) and max(xl) < 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()))
a.append(x)
b.append(y)
a =sorted(a)
b =sorted(b)
if a[-1]<b[0]:
    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()))
if max(x + [X]) < min(y + [Y]):
  print("No War")
else:
  print("War")

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N, M, X, Y = map(int, readline().split())
    x_max = max(list(map(int, readline().split())))
    y_min = min(list(map(int, readline().split())))
    if max(X,x_max)<min(Y,y_min):
        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()))
cnt = 0
for z in range(-100, 101):
    if X < z and z <= Y and max(x) < z and min(y) >= z:
        print("No War")
        break
    else:
        cnt += 1
        if cnt == 201:
            print("War")
            break

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 max(x)<Y and min(y)>X 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()))
xr = max(x)
yl = min(y)

for i in range(X+1,Y+1):
    if(xr < i <= 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()))

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

if X < z <= Y and x_max < z:
  print('No War')
else:
  print('War')

Submission status: Accepted

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

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

xx = max(xl)
xx = max(xx,x)
yy = min(yl)
yy = min(yy,y)

if xx<yy:
    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())
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,M,X,Y=list(map(int, input().split()))
xc=list(map(int, input().split()))
xc.append(X)
yc=list(map(int, input().split()))
yc.append(Y)
xc.sort()
yc.sort()
if xc[-1]>=yc[0]:
  print('War')
else:
  print('No War')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().split())
lx=list(map(int,input().split()))
ly=list(map(int,input().split()))
z=max(lx)+1 if max(lx)>=x else x+1

if min(ly)<z or y<z:
  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.sort()
y.sort()

Z_start=x[-1]+1
Z_end=y[0]

for z in range(Z_start, Z_end+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()))
z=[]
for i in range(X+1,Y+1):
    if max(x)<i and min(y)>=i:
        z.append(i)
if len(z)>=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.append(x)
Y.append(y)

if min(Y)-max(X) >= 1:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
n, m, x, y = list(map(int, input().split()))
xn = list(map(int, input().split()))
yn = list(map(int, input().split()))
maxx = max(xn)
miny = min(yn)
if x < miny and miny <= y and miny > maxx:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
n,m,x,y=map(int, input().split())
xlist=list(map(int, input().split()))
ylist=list(map(int, input().split()))
xlist.append(x)
ylist.append(y)
if max(xlist)<min(ylist):
  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()))
z = 'War'
for i in range(x+1,y+1):
    if max(xl) < i and i <= min(yl):
        z = 'No War'
        break
print(z)

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 < y[0] and x[-1] < 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()))
y_list = list(map(int,input().split()))

isWar = True
z = min(y_list)
if (x<z<=y) and (max(x_list)<z):
    isWar = False

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

Submission status: Accepted

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

p = list(map(int, input().split()))
q = list(map(int, input().split()))

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

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

Submission status: Accepted

Solution code:
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

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

min_z = max(X) + 1
max_z = min(Y)
ok = False
for z in range(min_z, max_z + 1):
    if A < z <= B:
        ok = True
if ok:
    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()))
for i in range(x+1, y+1):
    if max(xx) < i <= min(yy):
        print('No War')
        exit()
print('War')

Submission status: Accepted

Solution code:
n,m,x,y = map(int,input().split())
xl = list(map(int,input().split()))+[x]
yl = list(map(int,input().split()))+[y]
if max(xl)+1<=min(yl):
    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()))
ans="War"
x.append(X)
y.append(Y)
if max(x)<min(y):
        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()))
if (X < Y)&(max(x) < min(y))&(max(x) < Y)&(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()))
if (X < Y)&(max(x) < min(y))&(max(x) < Y)&(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()))
if min(Y,min(y))-max(X,max(x))>=1:
    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()))

x.append(X)
y.append(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 = sorted(x)
y = sorted(y)

#X < x[-1]では境界値が抜けている。
if x[-1] < y[0] and X <= x[-1] 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()))

x = sorted(x)
y = sorted(y)

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

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

    if max(X) < min(Y):
        print('No War')
    else:
        print('War')

    return


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

Submission status: Accepted

Solution code:
import sys
n, m, x, y = map(int, input().split())
x1 = max(list(map(int, input().split())))
y1 = min(list(map(int, input().split())))


for i in range(x+1, y+1):
    if x1 < i <= y1:
        print('No War')
        sys.exit()
print('War')

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [input() for _ in range(n)]


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

xmax = max(xl)
ymin = min(yl)

isWar = True
for i in range(x+1, y+1):
    if (xmax < i and ymin >= i):
        isWar = False
        break
if (isWar):
    print("War")
else:
    print("No 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()))
maxX = max(X_list)
minY = min(Y_list)
for z in range(maxX+1, minY+1):
    if z > X and Y >= z:
        print("No War")
        exit()
print("War")

Submission status: Accepted

Solution code:
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    n, m, x, y = nm()
    X = nl()
    Y = nl()
    xx = max(X)
    yy = min(Y)
    for z in range(-100, 101):
        if x < z <= y and xx < z <= yy:
            print('No War')
            return
    print('War')


if __name__ == '__main__':
    main()

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

Submission status: Accepted

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

if lx[-1] < ly[0]:
        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())) + [x]
b = list(map(int, input().split())) + [y]
print ("No War" if max(a) < min(b) else "War")

Submission status: Accepted

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

print('No War' if max(A) < min(B) else 'War')

Submission status: Accepted

Solution code:
N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
for Z in range(X+1,Y+1):
  if max(x)<Z<=min(y) :
    print("No War")
    exit()
print("War")

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().strip().split(" "))
ar1=[int(i) for i in input().strip().split(" ")]
ar2=[int(i) for i in input().strip().split(" ")]
ar1.append(x)
ar2.append(y)
m1=max(ar1)
m2=min(ar2)
if m2>m1:
    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()))

l = max(X)
r = min(Y)

print('No War' if l < r and not (y <= l or r <= x) else '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()))
flg = False
for Z in range(-100,101):
    if X<Z<=Y and max(A)<Z and min(B) >= Z:
        flg = True
if flg:
    print("No War")
else:
    print("War")

Submission status: Accepted

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

Submission status: Accepted

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

    if X < x[len(x)-1] < y[0] < Y:
        print('No War')
    else:
        print('War')
main()

Submission status: Accepted

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

l = []

for i in range(x+1, y+1):
    l.append(i)
    
for i in l:
    if max(l_X) < i:
        if min(l_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()))
x.append(X)
y.append(Y)
if max(x) >= min(y):
  print("War")
else:
  print("No War")

Submission status: Accepted

Solution code:
N,M,X,Y = (int(T) for T in input().split())
ACityMax = sorted(int(T) for T in input().split())[-1]
BCityMin = sorted(int(T) for T in input().split())[0]
if ACityMax<BCityMin and ACityMax<Y and X<BCityMin:
    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()))
mx=max(X)
my=min(Y)
if mx<my:
    for i in range(mx+1,my+1):
        if x<i<=y:
            print("No War")
            exit()
    print("War")
    
        
    

else:
    print("War")

Submission status: Accepted

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

city_a = []
city_b = []

v = input().split()
w = input().split()

for i in range(n):
    city_a.append(int(v[i]))
for i in range(m):
    city_b.append(int(w[i]))

city_a.sort()
city_b.sort()

p = city_a.pop()
q = city_b[0]

check = False

for i in range(x + 1, y+1):
    if p < i <= q:
        check = True
        break

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

Submission status: Accepted

Solution code:
*_,x,y=map(int,input().split())
for i in [i for i in range(max(list(map(int,input().split())))+1,min(list(map(int,input().split())))+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())
for i in [i for i in range(max(list(map(int,input().split())))+1,min(list(map(int,input().split())))+1)]:
  if x<i<=y: print('No War');break
else:
  print('War')

Submission status: Accepted

Solution code:
if __name__ == '__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()

	flg = False
	#xの場所がYのFROM-に入っていないこと
	if (Y[0] <= x):
		flg = True
	#yの場所がXのFROM-に入っていないこと
	elif (y <= X[n-1]):
		flg = True
	#Xの右端とYの左端が交わらないこと
	elif (X[n-1] >= Y[0]):
		flg = True
 
	if flg:
		print("War")
	else:
		print("No War")

Submission status: Accepted

Solution code:
if __name__ == '__main__':
	n,m,X,Y = map(int,input().split())
	x = list(map(int,input().split()))
	y = list(map(int,input().split()))
 
	x_max = max(x)
	y_min = min(y)

	flg = False
	for Z in range(X+1,Y+1):
		if x_max < Z <= y_min:
			flg = True
			break

	if flg:
		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,min(y)) - max(X,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()))
war_flag = True

for z in list(range(X+1, Y+1)):
    if max(x) < z and min(y) >= z:
        war_flag = False
        break

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

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().split())
x,y=[x],[y]
x.extend(list(map(int,input().split())))
y.extend(list(map(int,input().split())))
x.sort()
y.sort()
if x[-1]>=y[0]:
  print('War')
else:
  print('No 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()))
x.append(X)
y.append(Y)
maxX = max(x)
minY = min(y)
if maxX < minY:
    print("No War")
else:
    print("War")

Submission status: Accepted

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

for i in range(-100,101):
  if x<i and i<=y and max(l)<i and min(r) >= 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()))
max_x=max(x)
min_y=min(y)
for Z in range(X+1,Y+1):
    if max_x<Z<=min_y:
        print("No War")
        exit()
print("War")

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())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))

XR = max(xs)
YL = min(ys)

for i in range(X+1, Y+1):
  if XR < i and i <= YL:
    print("No War")
    exit()

print("War")

Submission status: Accepted

Solution code:
MM = input().split()
N = int(MM[0])
M = int(MM[1])
X = int(MM[2])
Y = int(MM[3])
xx = input().split()
yy = input().split()
xxx =[]
yyy =[]
for i in xx:
  xxx.append(int(i))
for i in yy:
  yyy.append(int(i))
xxx.sort()
yyy.sort()
count =0
for i in range(X+1,Y+1):
  if xxx[-1] < i and yyy[0] >= i:
    count +=1
    
if count == 0:
  print('War')
else:
  print('No War')

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
XL = list(map(int, input().split())) + [X]
YL = list(map(int, input().split())) + [Y]
XL.sort()
YL.sort(reverse=True)
xt = XL.pop()
yt = YL.pop()
if xt < yt:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
# abc110_b.py
# https://atcoder.jp/contests/abc110/tasks/abc110_b

# B - 1 Dimensional World's Tale /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 200点

# 問題文
# この世界は 1次元世界であり、世界を治める 2つの帝国はそれぞれ A 帝国、B 帝国と呼ばれています。
# A 帝国の首都は座標 X、B 帝国の首都は座標 Yに位置しています。
# ある日、A 帝国は座標 x1,x2,...,xN、B 帝国は座標 y1,y2,...,yMの都市を支配下に置きたくなりました。
# このとき、以下の 3つの条件をすべて満たす整数 Zが存在すれば、合意が成立して戦争は起きませんが、存在しない場合には戦争が起こります。
#     X<Z≤Y
#     x1,x2,...,xN<Z
#     y1,y2,...,yM≥Z
# 戦争が起こるかどうか判定してください。

# 制約
#     入力はすべて整数である
#     1≤N,M≤100
#     −100≤X<Y≤100
#     −100≤xi,yi≤100
#     x1,x2,...,xN≠X
#     xiはすべて異なる
#     y1,y2,...,yM≠Y
#     yiはすべて異なる

# 入力
# 入力は以下の形式で標準入力から与えられる。
# N M X Y
# x1 x2 ... xN
# y1 y2 ... yM

# 出力
# 戦争が起こるなら War、そうでないなら No War を出力せよ。

# 入力例 1
# 3 2 10 20
# 8 15 13
# 16 22

# 出力例 1
# No War

# Z=16とすれば、次のように 3つの条件をすべて満たすので合意が成立し、戦争は起きません。
#     X=10<16≤20=Y
#     8,15,13<16
#     16,22≥16

# 入力例 2
# 4 2 -48 -1
# -20 -35 -91 -23
# -22 66

# 出力例 2
# War

# 入力例 3
# 5 3 6 8
# -10 3 1 5 -100
# 100 6 14

# 出力例 3
# War


def calculation(lines):
    # N = int(lines[0])
    N, M, X, Y = list(map(int, lines[0].split()))
    xs = list(map(int, lines[1].split()))
    ys = list(map(int, lines[2].split()))
    xs.append(X)
    ys.append(Y)
    max_x = max(xs)
    min_y = min(ys)
    if max_x < min_y:
        return ['No War']
    else:
        return ['War']


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['3 2 10 20', '8 15 13', '16 22']
        lines_export = ['No War']
    if pattern == 2:
        lines_input = ['4 2 -48 -1', '-20 -35 -91 -23', '-22 66']
        lines_export = ['War']
    if pattern == 3:
        lines_input = ['5 3 6 8', '-10 3 1 5 -100', '100 6 14']
        lines_export = ['War']
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    if len(args) == 1:
        mode = 0
    else:
        mode = int(args[1])
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(3)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
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 = max(xn)
ym = min(ym)

for z in range(x+1,y+1):
    if xn< z <=ym:
        print('No War')
        exit()
print('War')

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

for z in range(x+1,y+1):
    if xn[-1]< z <=ym[0]:
        print('No War')
        exit()
print('War')