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

Submission status: Accepted

Solution code:
n, m, x, y = map(int, input().split())
l_a = list(map(int, input().split()))
l_b = list(map(int, input().split()))
l_a.append(x)
l_b.append(y)
l_a = sorted(l_a)
l_b = sorted(l_b)
if l_a[-1] < l_b[0]:
    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())))
ans = 'War'
for Z in range(X+1,Y+1):
    if x < Z <= y:
        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()))
print("No War" if max(x)<min(y) and max(x)<Y and X<min(y) else "War")

Submission status: Accepted

Solution code:
import sys
import numpy as np
input = sys.stdin.readline
N, M , X, Y = [int(x) for x in input().split()]
x = [int(x) for x in input().split()]
y = [int(x) for x in input().split()]
xmax = max(x)
ymin = min(y)
Z = [int(x) for x in range(X + 1, Y + 1)]
for z in Z:
    if xmax < z and ymin >= z:
        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()))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().split())
xi=sorted(list(map(int,input().split())))
yi=sorted(list(map(int,input().split())))
if(max(xi[-1],x)<min(yi[0],y)):
    print("No War")
else:
    print("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()))
for i in range(x+1,y+1):
    if all(a<i for a in xi) and all(b>=i for b in yi):
        print("No War")
        break
else:
    print("War")

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
n, m, x, y = map(int, input().split())
list_x = list(map(int, input().split()))
list_y = list(map(int, input().split()))
if max(x, max(list_x)) < min(y, min(list_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()))
ans = "War"
for i in range(x + 1,y - x + x + 1):
  if max(X) < i and min(Y) >= i:
    ans = "No War"
print(ans)

Submission status: Accepted

Solution code:
# 
import math
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
n,m,x,y=nm()
X = nl()
Y = nl()
Z = []
z = 0
if max(X)<min(Y):
    z=max(X)+1
else:
    print('War')
    exit()

for i in range(z,min(Y)+1):
    Z.append(i)


if len(Z)==0:
    print('War')
    exit()

is_war = True
for i in range(len(Z)):
    if x<Z[i]<=y:
        is_war = False
    else:
        pass
if is_war:
    print('War')
else:
    print('No War')

Submission status: Accepted

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

xi.append(x)
yi.append(y)

ans = 0
for i in range(-100,100):
    check = 0
    for j in xi:
        if i <= j:
            check = 1
    for k in yi:
        if i > k:
            check = 1
    if check == 0:
        ans = 1
        break
if ans == 1:
    print('No War')
else:
    print('War')

Submission status: Accepted

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

x1 = max(map(int,input().split())) + 1
y1 = min(map(int,input().split()))

if x1 <= y1 and x1 <= y and y1 > x:
    print('No War')
else:
    print('War')

Submission status: Accepted

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

x1 = max([int(i) for i in input().split()]) + 1
y1 = min([int(i) for i in input().split()])

if x1 <= y1 and x1 <= y and y1 > 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()))

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

if max(x[-1], X) < min(y[0], Y):
  print("No War")
else:
  print("War")

Submission status: Accepted

Solution code:
n,m,s,t = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.sort()
y.sort()
for i in range(-101,101):
    if x[-1] < i <= y[0] and s < i <= t:
        print("No War")
        exit()
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()))

    xx = max(x)
    yy = min(y)

    if max(xx, X) < min(yy, Y):
        print("No War")
    else:
        print("War")


main()

Submission status: Accepted

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

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


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

    for z in range(x+1,y+1):
        if sorted(X)[-1] < z:
            if z <= sorted(Y)[0]:
                print('No War')
                return
    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 (X < max(x)) and (max(x) < min(y)) and (min(y) <= Y):
    print("No War")
else:
    print("War")

Submission status: Accepted

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

Submission status: Accepted

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

for z in range(-100, 101):
    if (x < z) and (z <= y) and (max(ls_x) < z) and (z <= min(ls_y)):
        print("No War")
        break
    elif z == 100:
        print("War")

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().split())
x1=max(map(int,input().split()))
x2=min(map(int,input().split()))
z=list(range(x+1,y+1))
for i in z:
	if x1<i<=x2:
		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(" ")))
y=list(map(int,input().split(" ")))

if max(X,sorted(x)[-1])<min(Y,sorted(y)[0]): # 戦争が起こらない場合
    print("No War")
else: # 戦争が起こる場合
    print("War")

Submission status: Accepted

Solution code:
n,m,x,y = map(int,input().split())
list_x = list(map(int,input().split()))
list_y = list(map(int,input().split()))
xmax = max(list_x)
ymin = min(list_y)
for i in range(x+1,y+1):
  if xmax < i and i <= ymin:
    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()))
x.sort()
y = list(map(int,input().split()))
y.sort()
Z = y[0]
if x[-1] < y[0] and X < Z <= Y:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0

n,m,x,y=map(int,input().split())
X=list(map(int,input().split()))
Y=list(map(int,input().split()))
x+=1
xm=max(X)+1;ym=min(Y)
if x>y or xm>ym:
    print("War")
    exit()
if xm<=y and ym>=x:
    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()))
flag=False
for z in range(x+1,y+1):
  #print(z)
  if max(xlist)<z and min(ylist)>=z:
    flag=True
    #print(z)
print("No War" if flag else "War")

Submission status: Accepted

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

ans = 'War'
for z in range(-100, 101):
    if x < z <= y and max(xs) < z <= min(ys):
        ans = 'No War'
        break
    
print(ans)

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


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

if max(A + [X]) < min(B + [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()))

xa = max(x)
ya = min(y)

for i in range(X+1, Y+1):
    if xa < i <= ya:
        print('No War')
        exit()
print('War')

Submission status: Accepted

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

x.sort(key=lambda x: -x)
y.sort()
left = x[0]
right = y[0]

if left < right:
    flag = False
    while left != right:
        left = left + 1
        if X < left and left < Y and left <= right:
            flag = True
            break
    print('No War') if flag 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()))
if X>=Y:
    print("War")
    exit()
for Z in range(X,Y):
    if max(x)<=Z<min(y):
        print("No War")
        exit()
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()))
if max(max(xlist),x) <min(min(ylist),y) :
    print("No War")
else :
    print("War")

Submission status: Accepted

Solution code:
#テストファイルで実行する時
import sys
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')

n,m,x1,y1 = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))

#xというリストにx1という数字を追加する
x.append(x1)
y.append(y1)

x.sort()
y.sort()

if x[len(x)-1]<y[0]:
	print('No War')
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()]
x_cities_wants_A = [int(s) for s in input().split()]
y_cities_wants_B = [int(s) for s in input().split()]

is_break_out = 'War'

x_cities_wants_A.sort()
y_cities_wants_B.sort()

if y - x >= 1:
    for i in range(x + 1, y + 1):
        if i > max(x_cities_wants_A) and i <= min(y_cities_wants_B):
            is_break_out = 'No War'

print(is_break_out)

Submission status: Accepted

Solution code:
import sys
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):
    for i in range(max(xl)+1, min(yl)+1):
        if x < i <= y:
            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)<Y:
  print('No War')
else:
  print('War')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, X: int, Y: int, x: "List[int]", y: "List[int]"):
    ymin = min(min(y), Y)
    Z = ymin
    if max(max(x), X) < Z:
        print("No War")
    else:
        print("War")


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

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()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, M, X, Y = MAP()
x = LIST()
y = LIST()

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")
		break
else:
	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 permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

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()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    n, m, x, y = MAP()
    x_max = max(LIST())
    y_min = min(LIST())

    for z in range(x+1, y+1):
        if x_max < z <= y_min:
            print('No War')
            sys.exit()
    print('War')


if  __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
n, m, X, Y = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
print(("No " if max(X, *x) < min(Y, *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.sort()
Y.sort()
if x <= X[-1] and X[-1] < Y[0] and Y[0] <= y:
  print("No War")
else:
  print("War")

Submission status: Accepted

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

num = []
if sorted(x)[-1] < sorted(y)[0]:
    for i in range(sorted(x)[-1] + 1, sorted(y)[0] + 1):
        num.append(i)
else:
    print("War")
    exit()

for i in num:
    if X < i <= Y:
        print("No War")
        exit()

print("War")

Submission status: Accepted

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

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

answer = 'War' if y <= x else 'No War'

print(answer)

Submission status: Accepted

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

max_x = max(xn + [x])
min_y = min(yn + [y])

print("War" if max_x >= min_y else "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()))
 
flag = 0
 
l = list(range(max(x)+1, min(y)+1))
 
for i in l:
  if X < i and i <= Y:
    flag = 1
    
if max(x) >= min(y):
  print('War')
elif flag == 0:
  print('War')
else:
  print('No War')

Submission status: Accepted

Solution code:
# 2019-11-10 15:45:20(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    n, m, X, Y = (int(i) for i in sys.stdin.readline().split())
    x = [int(x) for x in sys.stdin.readline().split()]
    y = [int(y) for y in sys.stdin.readline().split()]
    max_x = max(x + [X])
    min_y = min(y + [Y])
    if Y - X < 1 or min_y - max_x < 1:
        ans = 'War'
    else:
        ans = 'No War'
    
    print(ans)
    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from sys import stdin
import fractions

n,m,x,y = [int(x) for x in stdin.readline().rstrip().split()]

lx = list(map(int,stdin.readline().rstrip().split()))
ly = list(map(int,stdin.readline().rstrip().split()))

lx.sort()
ly.sort()

if lx[-1]>=ly[0]:
    print("War")
    exit()

li = []

for i in range(lx[-1]+1,ly[0]+1):
    li.append(i)

for i in li:
    if x<i<=y:
        print("No War")
        exit()

print("War")

Submission status: Accepted

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

Submission status: Accepted

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

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

main()

Submission status: Accepted

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

Submission status: Accepted

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

x_lst = list(map(int, input().split()))
y_lst = list(map(int, input().split()))

if min(y_lst) - max(x_lst) <= 0:
	print("War")
else:
	flg = 1
	for i in range(max(x_lst) + 1, min(y_lst) + 1):
		if X < i and i <= Y:
			flg = 0
			print("No War")
			break
	if flg:
		print("War")

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

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

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

# print(x)
# print(y)

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

# print(x)
# print(y)

# print(max(x))
# print(min(y))

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
xmax = max(x)
ymin = min(y)
if(xmax < ymin and X < ymin and xmax < 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) + 1 <= min(y):
    Z = max(x) + 1

else:
    print("War")
    exit()

if X < Z and Z <= Y:
    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())))
for i in range(X[-1], Y[0]):
  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()))

j = 0
for z in range(X+1, Y+1):
	if max(x) < z and z <= min(y):
		j = 1
		break
if j == 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()))
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()))
y1=min(Y)
x1=max(X)
if x<y1 and x1<y:
    if x1<y1:
        print('No War')
    else:
        print('War')
else:
    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.append(x)
ym.append(y)
if max(xn) < min(ym):
  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()))

count = 0

for i in range(x+1, y+1):
    if max(X) < i and min(Y) >= i:
        count += 1
        break

if count == 1:
    print('No War')
else:
    print('War')

Submission status: Accepted

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

for i in range(X+1,Y+1):
  if max(x_list) < i and min(y_list) >= i:
    print("No War")
    break
else:
  print("War")

Submission status: Accepted

Solution code:
n, m, x, y = [int(x) for x in input().split()]
X = [int(x) for x in input().split()]
Y = [int(x) for x in input().split()]
isOK = max(X)< min(Y) and x < max(X) and min(Y) <= y
print('No War' if isOK 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(x) for x in 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())
xl=sorted([int(i) for i in input().split()])
yl=sorted([int(i) for i in input().split()])

print('No War' if max(x,xl[-1]) < min(y,yl[0]) else 'War')

Submission status: Accepted

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

xs = list(map(int,(input().split())))
ys = list(map(int,(input().split())))

xs.append(X)
ys.append(Y)

xs = sorted(xs)
ys = sorted(ys)

if xs[0] < ys[0]:
  if xs[-1] < ys[0]:
    print("No War")
  else:print("War")
elif ys[0] < xs[0]:
  if ys[-1] < xs[0]:
    print("No War")
  else:print("War")

Submission status: Accepted

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]
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())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
x.append(X)
y.append(Y)
x.sort()
y.sort()
if x[-1]>=y[0]:
  print("War")
else:
  print("No War")

Submission status: Accepted

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

Submission status: Accepted

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

x = [X]
y = [Y]

x+=[int(i) for i in input().split()]
y+=[int(i) for i in input().split()]

if max(x) < min(y):
    ans='No War'
else:
    ans='War'
    
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()))
a.sort()
b.sort()

for i in range(x+1, y+1):
	if(i <= a[-1]):
		continue
	if(i > b[0]):
		continue
	print ("No War")
	exit()
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())
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 min(y) >= i:
        ans = "No War"
        break
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

N, M, X, Y = list(map(int, input().split()))
x_list = list(map(int, input().split()))
y_list = list(map(int, input().split()))

if max(x_list) < min(y_list) and max(x_list) > X and min(y_list) <= Y:
    ans = "No War"
else:
    ans = "War"

print(ans)

Submission status: Accepted

Solution code:
n, m, x, y = map(int, input().split())
x_list = list(map(int, input().split()))
y_list = list(map(int, input().split()))
x_max = max(x_list)
y_min = min(y_list)
if x_max < y_min and x < y_min and x_max < 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()]
y = [int(i) for i in input().split()]

def check() :        
    for Z in range(max(x) + 1, min(y) + 1) :
        if X < Z <= Y :
            return 'No War'
    
    return 'War'
    
print(check())

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 min(y) > X and 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()))

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

flag = True
for i in range(X+1, Y+1):
    if i <= min_y and i > max_x:
        flag = False
        break
    
if flag == True:
    print("War")
else:
    print("No War")

Submission status: Accepted

Solution code:
n1, n2, n3, n4 = [int(i) for i in input().split()]

x1 = [int(i) for i in input().split()]
y1 = [int(i) for i in input().split()]

x1.append(n3)
y1.append(n4)

x2 = max(x1)
y2 = min(y1)

if x2 < y2:
    print("No War")
else:
    print("War")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def solve():
    n,m,x,y = map(int, input().split())
    X = max(map(int, input().split()))
    Y = min(map(int, input().split()))
    if X < y and x < Y and X < Y:
        return 'No War'
    else:
        return 'War'


if __name__ == '__main__':
    print(solve())

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

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    n, m, x, y = list(map(int, input().rstrip('\n').split()))
    xl = list(map(int, input().rstrip('\n').split()))
    xl.sort()
    yl = list(map(int, input().rstrip('\n').split()))
    yl.sort()
    for i in range(x + 1, y + 1):
        if xl[-1] < i <= yl[0]:
            print("No War")
            exit()
    print("War")


if __name__ == '__main__':
    slove()

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

ans = 'War'
for z in range(X+1,Y+1):
    war = False
    for x in xlist:
        if x >= z:
            war = True
            break
    if war:
        continue

    for y in ylist:
        if y < z:
            war = True
            break
    if war:
        continue

    if not war:
        ans = 'No War'
        break

print(ans)