Problem:


Score : 200 points

Problem Statement

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

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

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

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

X < Z \leq Y

x_1, x_2, ..., x_N < Z

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

Determine if war will break out.

Constraints

All values in input are integers.

1 \leq N, M \leq 100

-100 \leq X < Y \leq 100

-100 \leq x_i, y_i \leq 100

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

x_i are all different.

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

y_i are all different.

Input

Input is given from Standard Input in the following format:

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

Output

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

Sample Input 1

3 2 10 20
8 15 13
16 22

Sample Output 1

No War

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

X = 10 < 16 \leq 20 = Y

8, 15, 13 < 16

16, 22 \geq 16

Sample Input 2

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

Sample Output 2

War

Sample Input 3

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

Sample Output 3

War



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


Sample output:
No War

Submission status: Runtime Error

Solution code:
# 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(2)
    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: Runtime Error

Solution code:
N,M,X,Y=map(int,input().split())
ListX = list(map(int, input().split()))
ListY = list(map(int, input().split()))
ListX.sort()
ListX.sort()
threX = max(X,List[N-1])
threY = min(Y,List[0])
Z = threX+1
if threY >= Z:
  print("No War")
else:
  print("War")

Submission status: Runtime Error

Solution code:
import sys
N,M,X,Y = map(int,input().split())
array_x = list(map(int,input().split()))
array_y = list(map(int,input().split()))

if not ( 1 <= N <= 100 and 1 <= M <= 100 ): sys.exit()
if not ( -100 <= X <= 100 and -100 <= Y <= 100 ): sys.exit()
for I in array_x:
    if not ( -100 <= I <= 100 and array_x.count(I) == 1 and I != X): sys.exit()
for J in array_y:
    if not ( -100 <= J <= 100 and array_y.count(J) == 1 and J != Y): sys.exit()

if min(array_y) - max(array_x) >= 1:
    for K in range(max(array_x),min(array_y)+1):
        if X < K <= Y and max(array_x) < K and min(array_y) >= K:
            print('No War')
            sys.exit()
if min(array_x) - max(array_y) >= 1:
    for L in range(max(array_y),min(array_x)+1):
        if X < K <= Y and max(array_y) < K and min(array_x) >= K:
            print('No War')
            sys.exit()
print('War')

Submission status: Runtime Error

Solution code:
import sys
N,M,X,Y = map(int,input().split())
array_x = list(map(int,input().split()))
array_y = list(map(int,input().split()))

if not ( 1 <= N <= 100 and 1 <= M <= 100 ): sys.exit()
if not ( -100 <= X <= 100 and -100 <= Y <= 100 ): sys.exit()
for I in array_x:
    if not ( -100 <= I <= 100 and array_x.count(I) == 1 and I != X): sys.exit()
for J in array_y:
    if not ( -100 <= J <= 100 and array_y.count(J) == 1 and J != Y): sys.exit()

if min(array_y) - max(array_x) >= 1:
    for K in range(max(array_x),min(array_y)+1):
        if X < K <= Y and max(array_x) < K and min(array_y) >= K:
            print('No War')
            sys.exit()
if min(array_x) - max(array_y) >= 1:
    for L in range(max(array_y),min(array_x)+1):
        if X < K <= Y and max(array_x) < K and min(array_y) >= K:
            print('No War')
            sys.exit()
print('War')

Submission status: Runtime Error

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

if xl[0] < x and yl[0] >= y:
    print('No War')
else:
    print('War')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,m,x,y=map(int,input().split())
xx=list(map(int,input().split()))
yy=list(map(int,input().split()))
xxx=max(xx+list(x))
yyy=min(yy+list(y))
if xxx<yyy:
  print("No War")
else:
  print("War")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

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 = {X, *x}
    ys = {Y, *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: Runtime Error

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,Xs]) < min([Y,Ys]):
  print("No War")
else:
  print("War")

Submission status: Runtime Error

Solution code:

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

    x_s = list(map(int,input().split()))
    y_s = list(map(int,input().split()))

    x_max = max(x_s)
    y_min = min(y_s)

    ok = False
    for z in range(-101,101):
        #print(z)
        if x_max < z and y_min >= z and X < z and x <= Y:
            ok = True
            break
    answer =  "War" if ok else "No War"
    print(answer)





if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

xmax = max(xlist)
ymin = min(ylist)

checkCount = 0

if xmax <= ymin:
    print('War')
else:
    for i in range(x, y+1):
        if xmax < i and ymin >= i:
            checkCount += 1
    if checkCount > 0:
        print('No War')
    else:
        print('War')

Submission status: Runtime Error

Solution code:
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split())
y = list(map(int, input().split())
ans = False
for i in range(X+1, Y+1):
    if i > max(x) and i <= min(y):
        ans = True
        break

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

li_x.append(X)
li_y.append(Y)

li_x = set(li_x)
li_y = set(li_y)

if max(x1)>min(y1):
    print("War")
elif max(x1)<min(y1):
    print("No war")
elif max(x1)==min(y1):
    print("War")

Submission status: Runtime Error

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

Submission status: Runtime Error

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 x < y and X < y else and x < Y 'War')

Submission status: Runtime Error

Solution code:
n,m,x,y=map(int(input().split()))
tmpx=x
tmpy=y
for i in range(n):
  x_i=int(input())
  tmpx=max(tmpx,x_i)
for j in range(m):
  y_i=int(input())
  tmpy=min(tmpy,y_i)
if tmpx+1<=tmpy:
  print('No War')
else:
  print('War')

Submission status: Runtime Error

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

c=0
for i in range(X,Y+1):
  c =0
  if (i >=X and i <=Y) :
    c += 1
  if max(x) < i :
    c + =1
  if min(y) < i :
    c += 1
  
  if c == 3:
    print("No War")
    exit()
  else:
    continue
    
    
print("War")

Submission status: Runtime Error

Solution code:
def is_collided(x: int, y: int, xn: list, ym: list) -> bool:
    xn_max = max(xn)
    ym_min = min(ym)

    if xn_max > ym_min:
        return True
    # xn_max ~ ym_minとx ~ yが重なっていれば衝突しない
    if xn_max < x < ym_min or xn_max < y <= ym_min or \
    x < xn_max < y or x < x < ym_min <= y:
        return False
    return True


def main():
    line1: list = list( map(lambda x:int(x), input().split(' ')) )
    line2: list = list( map(lambda x:int(x), input().split(' ')) )
    line3: list = list( map(lambda x:int(x), input().split(' ')) )
    if is_collided(line1[2], line1[3], line2, line3):
        print("War")
    else:
        print("No War")

if __name__=='__main__':
    main()
    # print(is_collided(10, 20, [8, 5, 13], [16, 22]))
    # print(is_collided(-48, -1, [-20, -35, -91, -23], [-22, 66]))
    # print(is_collided(6, 8, [-10, 3, 1, 5, -100], [100, 6, 14]))

Submission status: Runtime Error

Solution code:
def is_collided(x: int, y: int, xn: list, ym: list) -> bool:
    xn_max = max(xn)
    ym_min = min(ym)

    if xn_max > ym_min:
        return True
    # xn_max ~ ym_minとx ~ yが重なっていれば衝突しない
    if xn_max < x < ym_min or xn_max < y <= ym_min or \
    x < xn_max < y or x < x < ym_min <= y:
        return False
    return True


def main():
    line1: list = list( map(lambda x:int(x), input().split(' ')) )
    line2: list = list( map(lambda x:int(x), input().split(' ')) )
    line3: list = list( map(lambda x:int(x), input().split(' ')) )
    if is_collided(line1[2], line1[3], line2, line3):
        print("War")
    else:
        print("No War")

if __name__=='__main__':
    main()

Submission status: Runtime Error

Solution code:
def is_collided(x: int, y: int, xn: list, ym: list) -> bool:
    xn_max = max(xn)
    ym_min = min(ym)

    if xn_max > ym_min:
        return True
    # xn_max ~ ym_minとx ~ yが重なっていれば衝突しない
    if xn_max < x < ym_min or xn_max < y <= ym_min or \
    x < xn_max < y or x < x < ym_min <= y:
        return False
    return True


def main():
    line1: list = list( map(lambda x:int(x), input().split(' ')) )
    line2: list = list( map(lambda x:int(x), input().split(' ')) )
    line3: list = list( map(lambda x:int(x), input().split(' ')) )
    if is_collided(line1[2], line2[3], line2, line3):
        print("War")
    else:
        print("No War")

if __name__=='__main__':
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# max min
n, m, x, y = map(int, input().split())
xs = max(list(map(int, input().split())))
ys = min(list(map(int, input().split())))
print("No War" if xs + 1 < ys else "War")
# max min
n, m, x, y = map(int, input().split())
xs = max(list(map(int, input().split())))
ys = min(list(map(int, input().split())))
print("No War" if xs + 1 <= ys else "War")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a

Submission status: Runtime Error

Solution code:
import sys

n,m,x,y = map(int, sys.stdin.readline().split())
x_list = list(map(int, sys.stdin.readline().split()))
y_list = list(map(int, sys.stdin.readline().split()))

x_max = max(x_list.append(x))
y_min = min(y_list.append(y))

if x < y:
    print("No War")
else:
    print("War")

Submission status: Runtime Error

Solution code:
import sys

n,m,x,y = map(int, sys.stdin.readline().split())
x_list = list(map(int, sys.stdin.readline().split()))
y_list = list(map(int, sys.stdin.readline().split()))

x_max = max(x_list.append(x))
y_min = min(y_list.append(y))

if x < y
    print("No War")
else:
    print("War")

Submission status: Runtime Error

Solution code:
import sys

n,m,x,y = map(int, sys.stdin.readline().split())
x_list = list(map(int, sys.stdin.readline().split()))
y_list = list(map(int, sys.stdin.readline().split()))

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

if y_min <= x_max
    print("War")
else:
    print("No War")

Submission status: Runtime Error

Solution code:
def main():

    inp1 = input().split()
    inp2 = input().split()
    inp3 = input().split()

    if(int(inp1[2]) >= int(inp1[3])):
        return "War"

    maximum = int(inp2[0])

    for i in range(int(inp1[0])):
        if maximum < int(inp2[i]):
            maximum = int(inp2[i])

    minimum = int(inp3[0])

    for i in range(int(inp1[1])):
        if minimum > int(inp3[i]):
            minimum = int(inp3[i])

    if(minimum <= maximum):
        return "War"

    return "No War"

print(main())

Submission status: Runtime Error

Solution code:
N,M,X,Y = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
a = max(A)
b = min(B)

flag = a>0 and b>0
if flag and a-b <= 0 and (Y < a and b <= X) and a<b:
  print('No War')
elif not flag and a-b >= 0 and (Y > a and b => X) and a>b:
  print('No War')
else:
  ('War')

Submission status: Runtime Error

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

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

if y[0]<x[-1]:
  print("War")
else:
  print("No War")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
3 2 10 20
8 15 13
16 22
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")
print(n,m,x,y,x1,x2)

Submission status: Runtime Error

Solution code:
n, m, x, y = map(int, input().split())
X = sorted(map(int, input().split()))
Y = sorted(map(int, input().split()))
for i in range(X[-1]:Y[0]):
  if x <= i < y:
    print("No War")
    exit()
print("War")

Submission status: Runtime Error

Solution code:
N, M, X, Y = map(int, input().split())
X = list(map(int, input().split()))
Y = list(map(int, input().split()))
flg = 'War'
for i in range(X, Y+1):
	if max(X) < i and i <= min(Y):
		flg = 'No ' + flg
		break
print(flg)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N, M, X, Y =list(map(int,input().split()))
a =max( [i for i in map(int, input().split())])                
b =min([i for i in map(int, input().split())])

for z in range(-101,101):
    if (x <= z <= y) and (a < z) and (b >= z):
        cnt +=1
        break

if cnt > 1:
    print('No War')
else:
    print('War')

Submission status: Runtime Error

Solution code:
ni = lambda: int(input())
nl = lambda: list(map(int, input().split()))
nm = lambda: map(int, input().split())

n, m, x, y = nm()
xmax = max(nl())+[x]
ymin = min(nl())+[y]

if xmax < ymin:
    print('No War')
else:
    print('War')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

xs.sort()
ys.sort()
flag=0
if xs[-1]<y:
  threshold=xs[-1]+1
if ys[0]>threshold:
    print('No War')
    flag=1
if flag==0:
  print('War')

Submission status: Runtime Error

Solution code:
n = int(input())

def zorome(n):
	l = []
	while n > 0:
		l.append(n%10)
		n = n//10
	return l

for i in range(n, 1000):
	ll = zorome(n)
	if ll[0] == ll[1] and ll[1] == ll[2]:
		break
	n += 1
print(n)

Submission status: Runtime Error

Solution code:

i = lambda:map(int,input().split())
_,_,x,y = i()
x_sigma = list(i())
y_sigma = list(i())
print('No War' if max(*x_sigma,x) < min(*y_sigma,y) else 'War')

Submission status: Runtime Error

Solution code:

i = lambda:map(int,input().split())
_,_,x,y = i()
print('No War' if max(*i(),x) < min(*i(),y) else 'War')

Submission status: Runtime Error

Solution code:
I=int(input().split())
x=int(input().split())
y=int(input().split())

if (min(y,I[3])-max(x,I[2]))>0:
    print('No War')
    
else :
    print('War')

Submission status: Runtime Error

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

if (min(y,Y)-max(x,X))>0:
    print('No War')
    
else :
    print('War')

Submission status: Runtime Error

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

if (min(y,Y)-max(x,X))>0:
    print('No War')
    
else :
    print('War')

Submission status: Runtime Error

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

ans = 'No War' if max(xx, x) < min(yy, y) else 'War'
print(ans)

Submission status: Runtime Error

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

ans = 'War'
for i in range(X,Y+1):
  if  max(x) < i <= min(y) and X < i <=y:
    ans ='No War'
    break
    

print(ans)

Submission status: Runtime Error

Solution code:
#include <assert.h>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
  int N, M, X, Y;
  cin >> N >> M >> X >> Y;
  vector<int> VX(N);
  vector<int> VY(M);
  for(auto i=0; i<N; ++i) {
    cin >> VX[i];
  }
  for(auto i=0; i<M; ++i) {
    cin >> VY[i];
  }
  sort(VX.begin(), VX.end());
  sort(VY.begin(), VY.end());

  for(auto i=X+1; i<=Y; ++i) {
    if((VX.back() < i) && (VY.front() >= i)) {
      cout << "No War" << endl;
      return 0;
    }
  }
  cout << "War" << endl;

  return 0;
}

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if x_city[len(x_city)-1] < y_city[0] and (x < y_city[0] <= y)
    print("No War")
else:
    print("War")

Submission status: Runtime Error

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

if max(x,X)<min(y,Y):
    print("No war")
else:
    print("War")

Submission status: Runtime Error

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

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

if (max(xs) < min(ys)) ans (X < Y):
    print("No War")
else:
    print("War")

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, m, x, y = [ int(v) for v in input().split() ]
xmax = sorted([ int(v) for v in input().split() ] + [x])
ymin = sorted([ int(v) for v in input().split() ] + [y])
ans = "War
if xmax < ymin:
  ans = "No War"
print(ans)

Submission status: Runtime Error

Solution code:
N, M, X, Y = map(int, input().split())
lstX = list(map(int, input(split()))).sort(reverse=True)
lstY = list(map(int, input(split()))).sort()
if lstX[0] > X and lstX[0] + 1 <= lstY[0] and lstX[0] + 1 <= Y:
    print('No War')
elif lstX[0] < X and X + 1 <= lstY[0] and X + 1 <= Y:
    print('No War')
else:
    print('War')

Submission status: Runtime Error

Solution code:
N,M,X,Y = map(int, input().split())
x = [int(_) for _ in input().split()]
y = list(map(int, input().split()))
maxX = max(x)
minY = min(y)

print(maxX,maxY)
for i in range(Y+1):
    if X < i <= Y and maxX < i and minY >= i:
        print("No War")
        break
    elif i == Y:
        print("War")
        break

Submission status: Runtime Error

Solution code:
def answer(n, m, x, y, x_array, y_array):
    max_x = x
    for i in range n:
        if x_array[i] > max:
            max_x = x_array[i]


    min_y = y
    for i in range m:
        if y_array[i] < min:
            min_y = y_array[i]

    if max_x < min_y:
        return "No War"
    else:
        return "War"


[n, m, x, y] = list(map(int, input().split()))
x_array = list(map(int, input().split()))
y_array = list(map(int, input().split()))
    
print(answer(n, m, x, y, x_array, y_array))

Submission status: Runtime Error

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

z1 = max(x) + 1
z2 = min(y)

if X < z1 and z1 < Y:
    if X < z2 and z2 < Y:
        if z1 <= z2:
            print ('No War')
            sys.exit()
print ('War')