CF812A.Sagheer and Crossroads
普及-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Sagheer is walking in the street when he comes to an intersection of two roads. Each road can be represented as two parts where each part has 3 lanes getting into the intersection (one for each direction) and 3 lanes getting out of the intersection, so we have 4 parts in total. Each part has 4 lights, one for each lane getting into the intersection (l — left, s — straight, r — right) and a light p for a pedestrian crossing.

An accident is possible if a car can hit a pedestrian. This can happen if the light of a pedestrian crossing of some part and the light of a lane that can get to or from that same part are green at the same time.
Now, Sagheer is monitoring the configuration of the traffic lights. Your task is to help him detect whether an accident is possible.
萨赫尔正在街上行走,当他来到两条道路的交叉路口时,发现每条道路都可以分为两个部分,每个部分包含3条驶入交叉路口的车道(每个方向各1条)和3条驶出交叉路口的车道,因此总共包含4个部分。每个部分有4盏信号灯:分别对应驶入交叉路口的3条车道(l — 左转,s — 直行,r — 右转),以及1盏供行人过街使用的信号灯 p。

若一辆汽车可能撞到行人,则会发生事故。当某个部分的行人过街信号灯 p 与另一盏能驶向该部分或从该部分驶出的车道信号灯同时为绿灯时,事故就可能发生。
目前,萨赫尔正在监控交通信号灯的配置。你的任务是帮助他判断是否可能发生事故。
输入格式
The input consists of four lines with each line describing a road part given in a counter-clockwise order.
Each line contains four integers l, s, r, p — for the left, straight, right and pedestrian lights, respectively. The possible values are 0 for red light and 1 for green light.
输入包含四行,每行按逆时针顺序描述一个道路段。
每行包含四个整数 l、s、r、p,分别表示左转、直行、右转和行人信号灯。可能的取值为:0 表示红灯,1 表示绿灯。
输出格式
On a single line, print "YES" if an accident is possible, and "NO" otherwise.
在一行中,如果可能发生事故,则输出 “YES”,否则输出 “NO”。
输入输出样例
输入#1
1 0 0 1 0 1 0 0 0 0 1 0 0 0 0 1
输出#1
YES
输入#2
0 1 1 0 1 0 1 0 1 1 0 0 0 0 0 1
输出#2
NO
输入#3
1 0 0 0 0 0 0 1 0 0 0 0 1 0 1 0
输出#3
NO
说明/提示
In the first example, some accidents are possible because cars of part 1 can hit pedestrians of parts 1 and 4. Also, cars of parts 2 and 3 can hit pedestrians of part 4.
In the second example, no car can pass the pedestrian crossing of part 4 which is the only green pedestrian light. So, no accident can occur.
在第一个例子中,可能发生一些事故,因为第 1 部分的车辆可能撞到第 1 和第 4 部分的行人。此外,第 2 和第 3 部分的车辆也可能撞到第 4 部分的行人。
在第二个例子中,没有车辆能够通过第 4 部分的人行横道,因为这是唯一亮起绿灯的行人信号灯。因此,不会发生任何事故。
输入解题思路,AI测评打分。不知道怎么写?