#ABC110B. 1 Dimensional World's Tale

1 Dimensional World's Tale

题目描述

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 XX, and that of Empire B is located at coordinate YY.

One day, Empire A becomes inclined to put the cities at coordinates x1,x2,...,xNx_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y1,y2,...,yMy_1, y_2, ..., y_M under its control.

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

  • X<ZYX \lt Z \leq Y
  • x1,x2,...,xN<Zx_1, x_2, ..., x_N \lt Z
  • y1,y2,...,yMZy_1, y_2, ..., y_M \geq Z

Determine if war will break out.

我们的世界是一维的,由两个帝国统治,分别称为帝国 A 和帝国 B。

帝国 A 的首都位于坐标 XX ,帝国 B 的首都位于坐标 YY

有一天,A 帝国倾向于将坐标 x1,x2,...,xNx_1, x_2, ..., x_N 处的城市置于其控制之下,B 帝国倾向于将坐标 y1,y2,...,yMy_1, y_2, ..., y_M 处的城市置于其控制之下。

如果存在满足以下三个条件的整数 ZZ ,他们就会达成协议,否则就会爆发战争。

  • X<ZYX \lt Z \leq Y
  • x1,x2,...,xN<Zx_1, x_2, ..., x_N \lt Z
  • y1,y2,...,yMZy_1, y_2, ..., y_M \geq Z

判断战争是否会爆发

输入格式

输入内容按以下格式标准输入:

NN MM XX YY
x1x_1 x2x_2 ...... xNx_N
y1y_1 y2y_2 ...... yMy_M

输出格式

如果战争爆发,则打印 "战争";否则,打印 "无战争"。

样例 #1

样例输入 #1

3 2 10 20
8 15 13
16 22

样例输出 #1

No War

样例 #2

样例输入 #2

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

样例输出 #2

War

样例 #3

样例输入 #3

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

样例输出 #3

War

说明

数据规模与约定

  • 输入值均为整数。
  • 1N,M1001 \leq N, M \leq 100
  • 100X<Y100-100 \leq X \lt Y \leq 100
  • 100xi,yi100-100 \leq x_i, y_i \leq 100
  • x1,x2,...,xNXx_1, x_2, ..., x_N \neq X
  • xix_i 都是不同的。
  • y1,y2,...,yMYy_1, y_2, ..., y_M \neq Y
  • yiy_i 都是不同的。

样例 11 解释

选择 Z=16Z = 16 满足以下三个条件,因此他们将达成一致。

  • X=10<1620=YX = 10 \lt 16 \leq 20 = Y
  • 8,15,13<168, 15, 13 \lt 16
  • 16,221616, 22 \geq 16