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: Wrong Answer

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 < ym_min <= y:
        return False
    return True


def main():
    line1 = list( map(lambda x:int(x), input().split(' ')) )
    line2 = list( map(lambda x:int(x), input().split(' ')) )
    line3 = 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: Wrong Answer

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( map(lambda x:int(x), input().split(' ')) )
    line2 = list( map(lambda x:int(x), input().split(' ')) )
    line3 = 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: Wrong Answer

Solution code:
N, M, X, Y = map(int, input().split())
x = input().split()
y = input().split()
x = [int(i) for i in x]
y = [int(i) for i in y]
x.sort()
y.sort()
if (x[-1] < y[0]) and (Y >= x[-1]) and (X < y[0]):
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

Solution code:
N,M,X,Y=map(int,input().split())
L1=list(map(int,input().split()))
L2=list(map(int,input().split()))
if max(L1)>min(L2):
    print("War")
elif X<=max(L1)<=Y or X<=min(L2)<=Y:
    print("No War")
else:print("War")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,M,X,Y=map(int,input().split())
L1=list(map(int,input().split()))
L2=list(map(int,input().split()))
if max(L1)>min(L2):
    print("War")
elif X<=max(L1)<=Y and X<=min(L2)<=Y:
    print("No War")

Submission status: Wrong Answer

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

Solution code:
input()
a=max(list(map(int,input().split())))
b=min(list(map(int,input().split())))
print("War" if a>b else "No War")

Submission status: Wrong Answer

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

if rightx < min(y, lefty):
  print('No War')
else:
  print('War')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
input()
if max(list(map(int, input().split()))) < min(list(map(int ,input().split()))):
  print('No War')
else:
  print("War")

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

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):
        for xi,yi in zip(x,y):
            if xi>=Z or yi<Z:
                break
        else:
            print('No War')
            exit()
    print('War')
            
                

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
from __future__ import print_function

import sys
input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


# import math
# import string
# import fractions
# from fractions import Fraction
# from fractions import gcd

# def lcm(n,m):
#     return int(n*m/gcd(n,m))

# import re
# import array
# import copy
# import functools
# import operator

# import collections
# import itertools
# import bisect
# import heapq

# from heapq import heappush
# from heapq import heappop
# from heapq import heappushpop
# from heapq import heapify
# from heapq import heapreplace

# from queue import PriorityQueue as pq

# def reduce(p, q):
#     common = fractions.gcd(p, q)
#     return (p//common , q//common )
# # from itertools import accumulate
# # from collections import deque

# from operator import mul
# from functools import reduce

# def combinations_count(n, r):
#     r = min(r, n - r)
#     numer = reduce(mul, range(n, n - r, -1), 1)
#     denom = reduce(mul, range(1, r + 1), 1)
#     return numer // denom

# import random
# import time


def reverse_range(a, b):  # b < a ,  get [b, a)
    return range(b, a, -1)  # range(a, b+1, -1)


def main():
    n, m, x, y = map(int, input().strip().split())
    l_x = list(map(int, input().strip().split()))
    l_x.sort(reverse=True)
    l_y = list(map(int, input().strip().split()))
    l_y.sort()

    eprint("range ", end=": ")
    eprint([i for i in reverse_range(x, y)[::-1]])

    for i in reverse_range(x, y)[::-1]:
        if l_x[0] < i < l_y[0]:
            print("No War")
            return
    print("War")
    return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from __future__ import print_function

import sys
input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


# import math
# import string
# import fractions
# from fractions import Fraction
# from fractions import gcd

# def lcm(n,m):
#     return int(n*m/gcd(n,m))

# import re
# import array
# import copy
# import functools
# import operator

# import collections
# import itertools
# import bisect
# import heapq

# from heapq import heappush
# from heapq import heappop
# from heapq import heappushpop
# from heapq import heapify
# from heapq import heapreplace

# from queue import PriorityQueue as pq

# def reduce(p, q):
#     common = fractions.gcd(p, q)
#     return (p//common , q//common )
# # from itertools import accumulate
# # from collections import deque

# from operator import mul
# from functools import reduce

# def combinations_count(n, r):
#     r = min(r, n - r)
#     numer = reduce(mul, range(n, n - r, -1), 1)
#     denom = reduce(mul, range(1, r + 1), 1)
#     return numer // denom

# import random
# import time


def reverse_range(a, b):  # b < a ,  get [b, a)
    return range(b, a, -1)  # range(a, b+1, -1)


def main():
    n, m, x, y = map(int, input().strip().split())
    l_x = list(map(int, input().strip().split()))
    l_x.sort(reverse=True)
    l_y = list(map(int, input().strip().split()))
    l_y.sort()

    for i in reverse_range(x, y)[::-1]:
        eprint("range ", end=": ")
        eprint([i for i in reverse_range(x, y)[::-1]])
        if l_x[0] < l_y[0]:
            print("No War")
            return
    print("War")
    return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from __future__ import print_function

import sys
input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


# import math
# import string
# import fractions
# from fractions import Fraction
# from fractions import gcd

# def lcm(n,m):
#     return int(n*m/gcd(n,m))

# import re
# import array
# import copy
# import functools
# import operator

# import collections
# import itertools
# import bisect
# import heapq

# from heapq import heappush
# from heapq import heappop
# from heapq import heappushpop
# from heapq import heapify
# from heapq import heapreplace

# from queue import PriorityQueue as pq

# def reduce(p, q):
#     common = fractions.gcd(p, q)
#     return (p//common , q//common )
# # from itertools import accumulate
# # from collections import deque

# from operator import mul
# from functools import reduce

# def combinations_count(n, r):
#     r = min(r, n - r)
#     numer = reduce(mul, range(n, n - r, -1), 1)
#     denom = reduce(mul, range(1, r + 1), 1)
#     return numer // denom

# import random
# import time


def main():
    n, m, x, y = map(int, input().strip().split())
    l_x = list(map(int, input().strip().split()))
    l_x.sort(reverse=True)
    l_y = list(map(int, input().strip().split()))
    l_y.sort()

    for i in range(x, y)[::-1]:
        if l_x[0] < l_y[0]:
            print("No War")
            return
    print("War")
    return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

#print(x)
#print(y)

distance = y[0] - x[-1]
#print(distance)

if distance >= 1 and (x[-1] + 1) <= y[0]:
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

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

#print(x)
#print(y)

distance = y[0] - x[-1]

if distance > 1:
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

Solution code:
input()
print(['War','No War'][sorted([int(i) for i in input().split()])[-1]<sorted([int(i) for i in input().split()])[0]])

Submission status: Wrong Answer

Solution code:
input()
print(['No War','War'][sorted([int(i) for i in input().split()])[-1]<sorted([int(i) for i in input().split()])[0]])

Submission status: Wrong Answer

Solution code:
input()
print(['No War','War'][sorted([int(i) for i in input().split()])<sorted([int(i) for i in input().split()])])

Submission status: Wrong Answer

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

# めっちゃ回りくどい解法
# x_list = sorted([int(i) for i in input().split()])
# y_list = sorted([int(i) for i in input().split()])
#
# x = x_list[-1]
# y = y_list[0]
# if x < y and any([X < z <= Y for z in range(x+1, y+1)]):
#     print('No War')
# else:
#     print('War')
#

x_list = [int(i) for i in input().split()]
y_list = [int(i) for i in input().split()]

if max(x_list) < min(y_list):
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

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

x = x_list[-1]
y = y_list[0]
if x < y and any([X < z <= Y for z in range(x, y+1)]):
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

Solution code:
import sys

N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
if X <= Y:
	Z = list(range(X+1,Y+1))
else:
	print('War')
	sys.exit()

Z_x = max(x)
Z_y = min(y)
if Z_x <= Z_y:
	Z_xy = list(range(Z_x+1,Z_y+1))
else:
	print('War')
	sys.exit()

for i in Z_xy:
	if i in Z:
		print('No War')
		sys.exit()
	else:
		print('War')
		sys.exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

x_z = max(x) + 1  #以上 最低ライン
y_z = min(y)  #以下 最高ライン
print(x_z, y_z)

if x_z <= y_z:
  if X < x_z <= Y:
    ans = "No War"
  else:
    for i in range(abs(y_z - x_z)):
      if X < x_z <= Y:
       ans = "No War"
       break
      else:
        x_z += 1
  if not X < x_z <= Y:
    ans = "War"
else:
  ans = "War"

print(ans)

Submission status: Wrong Answer

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 ys - xs < 1 and x <= xs and ys <= y else "War")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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 < ys else "War")

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
li = [int(i) for i in input().split()]
N = li[0]
M = li[1]
X = li[2]
Y = li[3]
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
maxx = -1000
for i in range(N) :
    maxx = max(maxx,x[i])
miny = 1000
a = "War"
for i in range(M) :
    miny = min(miny,y[i])
if maxx < miny :
    a = "No War"
print(a)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
li = [int(i) for i in input().split()]
N = li[0]
M = li[1]
X = li[2]
Y = li[3]
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
maxx = -1000
for i in range(N) :
    maxx = max(maxx,x[i])
miny = 1000
a = "War"
for i in range(M) :
    miny = min(miny,y[i])
if maxx < miny :
    for i in range(maxx,miny+1) :
        if i > X and i <= Y :
            a = "No War"
            break
print(a)

Submission status: Wrong Answer

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):
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

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: Wrong Answer

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

x1_max = max(x1)
x2_min = min(x2)

if x1_max <= x2_min and X <= Y and x2_min > X and x1_max < Y:   
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

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

if a[-1] < b[0]:
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

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

if min(lsty)-max(lstx) > 0:
    ans = "No War"
else:
    ans = "War"

print(ans)

Submission status: Wrong Answer

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

for z in range(-100, 101):
    if X < z and z <= Y:
        if max(Xpoints) < z:
            if min(Ypoints) >= z:
                print('No War')
else:
    print('War')

Submission status: Wrong Answer

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

if min(ys) - max(xs) > 0:
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

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_list.append(x)
y_list.append(y)
x_max = max(x_list)
y_min = min(y_list)

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

Submission status: Wrong Answer

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 x_max < y_min and x_max < y and y_min > x:
    print("War")
else:
    print("No War")

Submission status: Wrong Answer

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: Wrong Answer

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 x_max < y_min:
    print("No War")
else:
    print("War")

Submission status: Wrong Answer

Solution code:
def main():

    inp1 = input().split()

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

    inp2 = input().split()

    maximum = int(inp2[0])

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

    inp3 = input().split()

    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: Wrong Answer

Solution code:
def main():

    inp1 = input().split()

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

    inp2 = input().split()

    maximum = int(inp2[0])

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

    inp3 = input().split()

    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: Wrong Answer

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: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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)
 
if (Y >= a and b > X) and b >= a:
  print('No War')
else:
  print('War')

Submission status: Wrong Answer

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)
 
if (Y >= a and b > X) and a<b and b > a:
  print('No War')
else:
  print('War')

Submission status: Wrong Answer

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)
if (Y >= a and b > X) and a<b:
  print('No War')
else:
  print('War')

Submission status: Wrong Answer

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 (Y >= a and b > X) and a<b:
  print('No War')
elif not flag and (Y <= a and b < X) and a>b:
  print('No War')
else:
  print('War')

Submission status: Wrong Answer

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 (Y > a and b >= X) and a<b:
  print('No War')
elif not flag and (Y < a and b <= X) and a>b:
  print('No War')
else:
  print('War')

Submission status: Wrong Answer

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:
  print('War')

Submission status: Wrong Answer

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)


if a-b <= 0 and (X < a or b <= Y):
  print('No War')
else:
  print('War')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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 = 0
if max(X)<min(Y):
    z=max(X)+1
else:
    print('War')
    exit()

if z>y:
    print('War')
    exit()

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

Submission status: Wrong Answer

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: Wrong Answer

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: Wrong Answer

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: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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 or y1 > x):
    print('No war')
else:
    print('War')

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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)


if a-b <= 0 and (X+1 < a or b <= Y):
  print('No War')
else:
  print('War')

Submission status: Wrong Answer

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)


if a-b <= 0 and (X+1 < a and b <= Y):
  print('No War')
else:
  print('War')

Submission status: Wrong Answer

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)


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

Submission status: Wrong Answer

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)


if a-b <= 0 and (X+1 < a+1 or b <= Y):
  print('No War')
else:
  print('War')

Submission status: Wrong Answer

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)


if a-b <= 0 and (X < a+1 and b <= Y):
  print('No War')
else:
  print('War')

Submission status: Wrong Answer

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)


if a-b >= 0:
  print('War')
else:
  print('No War')

Submission status: Wrong Answer

Solution code:
def c(n):
  if ((Y-1) >= n):
    p = 0
  else:
    p = -1
  return p
def d(m):
  if ((X+1) <= m):
    p = 0
  else:
    p = -1
  return p
N,M,X,Y = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
a = list(map(c,A))
b = list(map(d,B))
if -1 in a and -1 in b:
  print('War')
else:
  print('No War')

Submission status: Wrong Answer

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: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

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: Wrong Answer

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: Wrong Answer

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: Wrong Answer

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")
	    break

Submission status: Wrong Answer

Solution code:
NMXY = list(map(int,input().split()))
N=NMXY[0]
M=NMXY[1]
X=NMXY[2]
Y=NMXY[3]
x=list(map(int,input().split()))
y=list(map(int,input().split()))
flag1=[]
flag2=[]

Z=list(range(X+1,Y+1))
print(Z)
Z2=[]
Z3=[]
for k in Z:
    if all([i<k for i in x]):
        Z2.append(k)


print(Z2)
for l in Z2:
    print(l)
    print(y)
    if all([l>=j for j in y]):
        Z3.append(l)

print(Z3)
if len(Z3)>0:
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

Solution code:
NMXY = list(map(int,input().split()))
N=NMXY[0]
M=NMXY[1]
X=NMXY[2]
Y=NMXY[3]
x=list(map(int,input().split()))
y=list(map(int,input().split()))
flag1=[]
flag2=[]

Z=list(range(X+1,Y+1))
print(Z)
Z2=[]
Z3=[]
for k in Z:
    if all([i<k for i in x]):
        Z2.append(k)


print(Z2)
for l in Z2:
    if all([j>=l for j in y]):
        Z3.append(k)

print(Z3)
if len(Z3)>0:
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

Solution code:
NMXY = list(map(int,input().split()))
N=NMXY[0]
M=NMXY[1]
X=NMXY[2]
Y=NMXY[3]
x=list(map(int,input().split()))
y=list(map(int,input().split()))
flag1=[]
flag2=[]

Z=list(range(X+1,Y+1))
print(Z)
Z2=[]
Z3=[]
for k in Z:
    if all([i<k for i in x]):
        Z2.append(k)


print(Z2)
for l in Z2:
    if all([j>=k for j in y]):
        Z3.append(k)

print(Z3)
if len(Z3)>0:
    print('No War')
else:
    print('War')

Submission status: Wrong Answer

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: Wrong Answer

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

ans = 'No War'
if not (x < y):
    ans = 'War'
if not (max(xs) < min(ys)):
    ans = 'War'
    
print(ans)