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:
N, M, X, Y = map(int, input().split())
xlist = input().split() # string
ylist = input().split() # string

def judge(z):
    for i in xlist:
        i = int(i)
        if not i < z:
            return 0
    for j in ylist:
        j = int(j)
        if j < z:
            return 0
        else:
            if str(j) == ylist[-1]:
                print('No War')
                sys.exit()

for z in range(X+1, Y+1):
    judge(z)
    if z == Y:
        print('War')

Submission status: Runtime Error

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

def judge(z):
    for i in xlist:
        i = int(i)
        if not i < z:
            return 0
    for j in ylist:
        j = int(j)
        if j < z:
            return 0
        else:
            if str(j) == ylist[-1]:
                print('No War')
                sys.exit()

for z in range(X+1, Y+1):
    judge(z)
    if z == Y-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()))
x = max(x)
x = min(X, max(x))
y = min(y)
y = min(Y, min(y))
if x < 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()))
xs.append(X)
ys.append(Y)
if min(ys) <= max(xs) 
    print('War')
else:
    print('No War')

Submission status: Runtime Error

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

xis = sorted(list(map(int,input().split())),reverse=True)
yis = sorted(list(map(int,input().split())))
 
ans = 'No War' (if xis[0] < yis[0]) and x < yis[0] and xis[0] < y else 'War'

print(ans)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left

def main():
	N, M, X, Y = map(int, input().split(" "))
	X = input().split(" ")
	X = [int(s) for s in X]
	Y = input().split(" ")
	Y = [int(s) for s in Y]
	
	X.sort()
	Y.sort()
	
	if X >= Y:
		print("War")
		sys.exit()
	
	tmp = Y[0] - X[len(X)-1]
	if tmp < 2:
		print("War")
		sys.exit()
		
	for i in range(X[len(X)-1]+1, Y[0]):
		if i <= Y and X < i:
			print("No War")
			sys.exit()
	
	
	print("War")
		
	
if __name__ == "__main__":
	main()

Submission status: Runtime Error

Solution code:
import sys
n,m,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
for z in range(101):
  if X<z<=Y and x[i]<z for i in range(n) and y[j]>=z for j in range(m):
    print('No War')
    sys.exit()
for z in range(1,101):
  if X<z*(-1)<=Y and x[i]<z*(-1) for i in range(n) and y[j]>=z*(-1) for j in range(m):
    print('No War')
    sys.exit()
print('War')

Submission status: Runtime Error

Solution code:
import sys
n,m,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
for z in range(101):
  if X<z<Y and x[i]<z for i in range(n) and y[j]>=z for j in range(m):
    print('No War')
    sys.exit()
for z in range(1,101):
  if X<z*(-1)<Y and x[i]<z*(-1) for i in range(n) and y[j]>=z*(-1) for j in range(m):
    print('No War')
    sys.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()))
x.sort()
y.sort()
if x[n-1] < y[0] and X < y[0] and y < x[n-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()))

x_max=max(a)
y_max=max(b)

coun="War"

for i in range(X,Y+1):
    if i>x_max and i<=y_min and i>X and i<Y:
        count="No War"

print(count)

Submission status: Runtime Error

Solution code:
N = int(input())
words = [input() for _ in range(N)]

for i, w in enumerate(words):
    if words.count(w) > 1:
        print('No')
        break
    if w[0] != words[i - 1][-1]:
        print('No')
        break
else:
    print('Yes')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

x.append(X)
y.append(Y)
xmax = max(X)
ymin = min(Y)
if xmax < ymin:
  print('No War')
else:
  print('War')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, m, x, y = map(int, input().split())
xs = max(list(map(int, input().split())).append(x))
ys = max(list(map(int, input().split())).append(y))
print('No War' if xs < 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()))
if X<Z<=Y and max(x)<Z and min(y)>=Z :
    print('No War')
else:
    print('War')

Submission status: Runtime Error

Solution code:
//============================================================================
// Name        : HelloWorld.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include<algorithm>
using namespace std;

int main() {
	int n,m,x,y;
	int X[1000],Y[1000];
	cin>>n>>m>>x>>y;
	for(int i=0;i<n;i++){
		cin>>X[i];
	}
	for(int j=0;j<m;j++){
		cin>>Y[j];

	}
	int X_max=-1000;
	int Y_min=1000;
	for(int i=0;i<n;i++){
		if(X_max<X[i]){
			X_max=X[i];
		}
	}
	for(int j=0;j<m;j++){
		if(Y[j]<Y_min){
			Y_min=Y[j];
		}
	}

	for(int k=x;k<y;k++){
		if(X_max<=k && k<=Y_min){
			cout<<"No War"<<endl;
			return 0;
		}

	}
	cout<<"War"<<endl;



}

Submission status: Runtime Error

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 (X < Y and max(x_lst) < min(y_lst) and X < min(y_lst) and max(x_lst) < 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 min(y)-max(x)>=2 and X<Y:
  if len(set(range(max(x)+1,min(y)))&set(range(X+1,Y+1)):
  	print('No War')
  else:
    print('War')
else:
  print('War')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
_,b,c,d,*e=map(int,open(0).read().split());print((c<max(e[:b])<min(e[b:]<d))*"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.append(X)
y.append(y)

for i in range(len(x)):
	for j in range(i, len(x)):
		if (x[i] == y[j]) or (y[i] == x[j]):
			print('War')
			exit()

if max(x) >= min(y):
	print('War')
	exit()

print('No War')

Submission status: Runtime Error

Solution code:
z,x,y=eval('map(int,input().split()),'*3);print('No War'[3*(max(z[2],*x)>=min(z[3],*y)):])

Submission status: Runtime Error

Solution code:
N,M,X,Y=[int(x) for x in stdin.readline().rstrip().split()]
datax=[int(x) for x in stdin.readline().rstrip().split()]
datay=[int(x) for x in stdin.readline().rstrip().split()]
if sorted(datax)[-1] < sorted(datay)[0]:
    print("No War")
else:
    print("War")

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

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

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

xmax = sorted(x, key=None ,reverse=True)[0]
ymin = sorted(y)[0]

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

Submission status: Runtime Error

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

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

xmax = sorted(x, key=None ,reverse=True)[0]
ymin = sorted(y)[0]

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

Submission status: Runtime Error

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

areaX.append(x)
areaY.append(y)

if maxX < minY:
    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()))
minB = min(B)
maxA = max(A)
for i in range(maxA, minB+1):
  if X < i and Y =< i:
    print("No War")
    exit()
  else:
    print("War")
    exit()

Submission status: Runtime Error

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

X.sort()
Y.sort()

if(y[0]-X[-1]>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()))

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

Submission status: Runtime Error

Solution code:
N,M,X,Y=(int(i) for i in input().split())
xlist=[].append(int(input()) for i in range(N))
ylist=[].append(int(input()) for i in range(M))
xmax=max(xlist)
ymin=min(ylist)
if xmax<ymin:
  if xmax<Y and X<ymin:
    print('No War')
  else:
    print('War')
else:
  print('War')

Submission status: Runtime Error

Solution code:
N,M,X,Y=(int(i) for i in input().split())
xlist=[int(input()) for i in range(N)]
ylist=[int(input()) for i in range(M)]
xmax=max(xlist)
ymin=min(ylist)
if xmax<ymin:
  if xmax<Y and X<ymin:
    print('No War')
  else:
    print('War')
else:
  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())

print(["War","No War"][X<min(y) and max(x)<Y and max(x)<min(y)])

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()))
p = x.append(X)
q = y.append(Y)
if min(q) >= max(p):
  print("No War")
else:
  print("War")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if X < max(xlist):
    xmax = max(xlist)
else:
    xmax = X

if Y > min(ylist):
    ymax = min(ylist)
else:
    ymin = Y

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

Submission status: Runtime Error

Solution code:
i=input;x=i().split();print('No '*(max(map(int,i().split().append(x[2])))<min(map(int,i().split().append(x[3]))))+'War')

Submission status: Runtime Error

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

if max(l_x) => min(l_y):
    print('War')
else:
    print('No War')

Submission status: Runtime Error

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

if xmax >= ymin 
    print('War')
else:
    print('No War')

Submission status: Runtime Error

Solution code:
3 2 10 20
8 15 13
16 22

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 = sorted(x)
y = sorted(y)
 
for i in range(X + 1, Y + 1):
  if( x[N-1] < i <= y[0]):
    print('No War')
    exit()
    
  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 = sorted(x)
y = sorted(y)

for i in range(X + 1, Y + 1):
  if( x[N-1] < i <= y[0]):
    print('No War')
    exit()
    
  else:
    print('war')
    break

Submission status: Runtime Error

Solution code:
n,m,x,y=list(map(int,input().split()))
l_x=list(map(int,input().split()))
l_y=list(map(int,input().split()))
x_max=max(l_x)
y_max=min(l_y)
for i in range(x_max+1,y_min):
    if x<i<=y:
        print('No War')
        exit()
print('War')

Submission status: Runtime Error

Solution code:
N, M, X, Y = map(int, input().split())
a = list(map(int, input().split()))
for i in range(M):
    if(i == 0):
        mx= a[i]
    else:
        mx = max(a[i],mx)
a = list(map(int, input().split()))
if(mx >= Y):
    print("War")
    quit()
for i in range(M):
    if(i == 0):
        my = a[i]
    else:
        my = min(a[i],my)
if(my <= X):
    print("War")
    quit()
if(mx >= my):
    print("War")
else:
    print("No War")

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;

int main()
{
  int N, M, X, Y;
  cin >> N >> M >> X >> Y;
  int x[N], y[M];
  for (int i = 0; i < N; ++i) {
    cin >> x[i];
  }
  for (int i = 0; i < M; ++i) {
    cin >> y[i];
  }
  for (int i = 0; i < N; ++i) {
    if (X < x[i]) X = x[i];
  }
  for (int i = 0; i < M; ++i) {
    if (Y > y[i]) Y = y[i];
  }
  if (X < Y) {
    cout << "No war" << "\n";
  }
  else {
    cout << "War" << "\n";
  }

  return 0;
}

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()))
c = 0
a.sort()
b.sort()
if a[len(a)-1] < b[0]:
 for i in range(a[len(a),b]):
  if i > x and i <= y:
   c = 1
   break
if c == 1:
 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()))

zx = list(range(max(x)+1,101))
zy = list(range(-100, min(y)+1))
kanou = set(zx) & set(zy)
if len(kanou) == 0:
    print('War')
else:
    for i in kanou:
        if X < i <= Y:
            print('No War')
            break
    else:
        print(War)

Submission status: Runtime Error

Solution code:
num1 = [int(i) for i in input().split()] 
x= [int(i) for i in input().split()] 
y= [int(i) for i in input().split()] 
x_max=0
y_max=0
i=0
print(type(x_max))
print(x[0],x[1],x[2])
print(x_max,y_max)

for i in range(len(x)):
    if x_max<x[i]:
        x_max=x[i]

for i in range(len(y)):
    if y_max<y[i]:
        y_max=y[i]

print("y_max=",y_max," x_max=",x_max)
if y_max-x_max>1:
    print("no war")
else:
    print("war")

Submission status: Runtime Error

Solution code:
N, M, _, _ = [int(inp) for inp in input().split(' ')]
X = [float(inp) for inp in input().split(' ')]
Y = [float(inp) for inp in input().split(' ')]

max_x = max(X)
min_y = min(Y)

if min_y <= max_x:
    print('War')
else:
    is_nowar = False
    for z in range(-100, 100+1):
        if z > max_x and z <= y_min:
            is_nowar = True

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

Submission status: Runtime Error

Solution code:
N, M, _, _ = [int(inp) for inp in input().split(' ')]
X = [float(inp) for inp in input().split(' ')]
Y = [float(inp) for inp in input().split(' ')]

max_x = max(X)
min_y = min(Y)

if min_y >= max_x:
    print('War')
else:
    is_nowar = False
    for z in range(-100, 100+1):
        if z > max_x and z <= y_min:
            is_nowar = True

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

Submission status: Runtime Error

Solution code:
N, M, _, _ = [int(inp) for inp in input().split(' ')]
X = [float(inp) for inp in input().split(' ')]
Y = [float(inp) for inp in input().split(' ')]

max_x = max(X)
min_y = min(Y)

if min_y >= max_x:
    print('War')
else:
    is_nowar = True
    for z in range(-100, 100+1):
        if z > max_x and z <= y_min:
            is_nowar = False

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

Submission status: Runtime Error

Solution code:
N, M, _, _ = [int(inp) for inp in input().split(' ')]
X = [float(inp) for inp in input().split(' ')]
Y = [float(inp) for inp in input().split(' ')]

max_x = max(X)
min_y = min(Y)


if min_y >= max_x:
    print('War')
else:
    is_war = False
    for z in range(-100, 100+1):
        if z <= max_x or z > y_min:
            is_war = True

    if is_war:
        print('War')
    else:
        print('No 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, X) < min(y, Y)):
    print("No War")
else:
    print("War")

Submission status: Runtime Error

Solution code:
cnds = [int(i) for i in input().split()]

posX = [int(i) for i in input().split()]
posY = [int(i) for i in input().split()]
posX.sort()
posY.sort()

max_x = posX[-1]
min_y = posY[0]
if cnds[2] < cnds[3]:
    if max_x < max_y:
        print('No War')
    else:
        print('War')
else:
    print('War')

Submission status: Runtime Error

Solution code:
N,M,X,Y = map(int, input().split())
num_list = [list(map(int, input().split())) for _ in range(2)]
 
x_max = max(num_list[0])
y_min = min(num_list[1])
 
if x_max >= y_max:
    print('War')
elif x_max < X or y_max > Y:
    print('War')
else:
    print('No war')

Submission status: Runtime Error

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

if X >= min(list1) or Y <= max(list2):
  print("War")
  
else:
  print("No War")

Submission status: Runtime Error

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

if X >= min(list_yi) or Y <= max(list_xi):
  print("War")
  
else:
  print("No War")

Submission status: Runtime Error

Solution code:
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#

"""
RC110 D
"""


n,m = map(int,input().split())

from math import sqrt
from collections import deque
def divisors(x):
    divs = deque()
    sx = int(sqrt(x))
    if x == sx**2:
        divs.append(sx)
        sx = sx-1
    for i in range(sx,0,-1):
        if x%i==0:
            divs.append(i)
            divs.appendleft(x//i)
    return(divs)

mdivs = list(divisors(m))
from collections import defaultdict
divsdict = defaultdict(list)
for d in mdivs:
    divsdict[d] = [dd for dd in mdivs if d%dd==0]

dpdict = defaultdict(int)
for d in mdivs:
    dpdict[d]=0
dpdict[1] = 1


cut = 10**9+7

for i in range(n):
    for d in mdivs:
        dpdict[d] = sum(map(lambda x:dpdict[x],divsdict[d]))%(10**9+7)

print(dpdict[m])

Submission status: Runtime Error

Solution code:
s=list(map(int,input().split()))
x=list(map(int,input().split()))
y=list(map(int,input().split()))
ma, mi = -100, 100
for i in range(s[0]-1):
    ma = max(ma, x[i])
for j in range(s[1]-1):
    mi = min(mi, y[j])
if (ma < mi and ma < s[3] and ((s[2] < mi <= s[3]) or (mi > s[3] and ma < s[3])):
    print("No War")
else:
    print("War")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,m,x,y = map(int,input().split())
a = [int(input()) for i in range(n)]
a.append(x)
b = [int(input()) for i in range(m)]
b.append(y)
for i in range(x+1,y+1):
  if max(a) < i <= max(b):
    print("No War")
else:
  print("War")

Submission status: Runtime Error

Solution code:
N,M,X,Y = map(int,input().split())
Lx = list(map(int,input().split()))
Ly = list(map(int,input().split()))
count = 0
for i in range(X;Y):
    if max(Lx) < i <= min(Ly):
        count += 1
if count > 0:
    print("No War")
else:
    print("War")

Submission status: Runtime Error

Solution code:
N,M,X,Y = map(int,input().split())
Lx = list(map(int,input().split()))
Ly = list(map(int,input().split()))
count = 0
for i in range(X:Y):
    if max(Lx) < i <= min(Ly):
        count += 1
if count > 0:
    print("No War")
else:
    print("War")

Submission status: Runtime Error

Solution code:
n,m,X,Y = 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: Runtime Error

Solution code:
n,m,X,Y = input().split()
x = list(map(int,input().split()))
y = list(map(int,input().split()))
x.append(X)
y.append(Y)
print(max(x)<min(y)?"No war":"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()))

def war():
 if max([X]+x) < min([Y]+y):
    print('No War')
else:
  print('War')

war()

Submission status: Runtime Error

Solution code:
print("No War" if (lambda a:max(a[0][2],max(a[1]))<min(a[0][3],min(a[2])))([int(j) for j in input().split()] for i in range(3)]) else "War")

Submission status: Runtime Error

Solution code:
# coding: utf-8
 
n, m, x, y = map(int, input().split())
xn = list(map(int, input().split()))
ym = list(map(int, input().split()))
flg = 0

if x < y:
    for i in range(x, y+1):
        if max(xn) < i and min(ym)>=i:
            print("No War")
            flg = 1
        elif flg = 0 and i == y:
            print("War")
else:
    print("No War")

Submission status: Runtime Error

Solution code:
# coding: utf-8
 
n, m, x, y = map(int, input().split())
xn = list(map(int, input().split()))
ym = list(map(int, input().split()))
flag = 0

if x < y:
    for i in range(x, y+1):
        if max(xn) < i and min(ym)>=i:
            print("No War")
            flag = 1
        if flag = 0 and i == y:
            print("War")
else:
    print("War")

Submission status: Runtime Error

Solution code:
# coding: utf-8
 
n, m, x, y = map(int, input().split())
xn = list(map(int, input().split()))
ym = list(map(int, input().split()))
 
if x < y:
    for i in range(x, y+1):
        if max(xn) < i and min(ym)>=i:
            print("War")
        elif i = y:
            print("No War")
else:
    print("No War")

Submission status: Runtime Error

Solution code:
# coding: utf-8
 
n, m, x, y = map(int, input().split())
xn = list(map(int, input().split()))
ym = list(map(int, input().split()))
 
if x < y:
    for i in range(x, y+1)
        if max(xn) < i and min(ym)>=i:
            print("War")
        elif i = y:
            print("No War")
else:
    print("No War")

Submission status: Runtime Error

Solution code:
# coding: utf-8
 
n, m, x, y = map(int, input().split())
xn = list(map(int, input().split()))
ym = list(map(int, input().split()))
 
if x < y:
    for i in range(x, y+1)
        if max(xn) < i and min(ym)>=i:
            print("War")
            exit
    print("No War")
else:
    print("No War")

Submission status: Runtime Error

Solution code:
# coding: utf-8
 
n, m, x, y = map(int, input().split())
xn = list(map(int, input().split()))
ym = list(map(int, input().split()))
 
if x < y:
    for i in range(x, y+1)
        if max(xn) < i and min(ym)>=i:
            print("War")
            exit
    else:
        print("No War")
else:
    print("No War")

Submission status: Runtime Error

Solution code:
# coding: utf-8
 
n, m, x, y = map(int, input().split())
xn = list(map(int, input().split()))
ym = list(map(int, input().split()))
 
if x < y:
    z = range(x, y+1)
    if max(xn) < z and min(ym)>=z:
        print("War")
    else:
        print("No War")
else:
    print("No War")

Submission status: Runtime Error

Solution code:
# coding: utf-8

n, m, x, y = map(int, input().split())
xn = list(map(int, input().split())
ym = list(map(int, input().split())

if x < y:
    if max(xn) < min(ym):
        print("War")
else:
    print("No War")

Submission status: Runtime Error

Solution code:
N = int(input())
M = int(input())
X = int(input())
Y = int(input())

x = [input() for i in range(N)]
y = [input() for i in range(M)]

x.sort(reverse=True)
y.sort()

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

Submission status: Runtime Error

Solution code:
N,M,X,Y = map(int, input().split())
num_list = [list(map(int, input().split())) for _ in range(M)]

Z = list(range(X+1,Y+1))

for z in Z:
    if max(num_list[0]) < z and min(num_list[1]) >= z:
        print('No War')
        break
    if z == Z[-1]:
        print('War')

Submission status: Runtime Error

Solution code:
import numpy as np

XY = np.asarray(input().split(), dtype=int)
X = np.asarray(input().split(), dtype=int)
Y = np.asarray(input().split(), dtype=int)

if np,sum(X==XY[2]) == 1 or np,sum(Y==XY[3]) == 1:
    print("no war")
elif np.max(X) <= np.min(Y):
    print("no war")
else:
    print("war"

Submission status: Runtime Error

Solution code:
input_lines = input().split()
X = input_lines[2]
Y = input_lines[3]
X_list = [int(j) for j in input().split()].sort()
Y_list = [int(i) for i in input().split()].sort()

if X in Y_list:
 print("War")
elif X_list[-1] <Y_list[0]:
 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()))+[x]);y=min(list(map(int,input.split()))+[y]);print('No War'if x<y else'War')

Submission status: Runtime Error

Solution code:
iptA=list(map(int,input().split()))
X=list(map(int,input().split())).append(iptA[2])
Y=list(map(int,input().split())).append(iptA[3])
     
xmax,ymax=max(X),max(Y)
if xmax>=ymax:
    print('War')
else:
    print('No War')

Submission status: Runtime Error

Solution code:
iptA=list(map(int,input().split()))
X=list(map(int,input().split())).append(iptA[2])
Y=list(map(int,input().split())).append(iptA[3])
  
xmax,ymax=max(X),max(Y)
if xmax>=ymax:
    print('War')
 else:
     print('No War')

Submission status: Runtime Error

Solution code:
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('Yes')
else:
    print('No')

Submission status: Runtime Error

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

Solution code:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define pb push_back
#define all(a) a.begin(), a.end()

int N, M;
vector<int> x, y;

int input() {
    int a;
    cin>>a;
    return a;
}

bool check() {
    return max_element(all(x)) < min_element(all(y));
}

int main() {
    
    cin >> N >> M;
    x.pb(input());
    y.pb(input());
    for( int i=0; i < N; ++i)x.pb(input());
    for( int i=0; i < M; ++i)y.pb(input());

    if(check())cout << "No War" << endl;
    else cout << "War" <<endl;

    return 0;
}

Submission status: Runtime Error

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

print('No War' if max(area_X) < min(area_Y) else 'War')

Submission status: Runtime Error

Solution code:
from functools import reduce

N, M, X, Y = tuple(map(int, input().split()))
want_X = [int(x) for x in inut().split()]
want_Y = [int(x) for x in inut().split()]

print('No War' if max(want_X + X) < min(want_Y + Y) else '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()))
aMAX = max(a)
bMIN = min(b)
if (a<b and a+1>x and a+1<=y):
  print("No War")
else:
  print("War")

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <algorithm>
using namespace std;

int main() {
  int N, M; cin >> N >> M;
  int XMAX, YMIN; cin >> XMAX >> YMIN;
  for (int i = 0; i < N; ++i) {
    int x; cin >> x;
    XMAX = max(XMAX, x);
  }
  for (int i = 0; i < M; ++i) {
    int y; cin >> y;
    YMIN = min(YMIN, y);
  }
  cout << (XMAX < YMIN ? "No War" : "War") << endl;
}

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()
x.reverse()
y.sort()

c = 0

for i in range(x[0]+1, y[0]+1):
    if (X < i) and (i <= Y) and (x[0] < i) and (y[0] >= i):
        c = 1
        break
        
if c = 0:
    print("War")
else:
    print("No war")