CF245A.System Administrator
入门
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Polycarpus is a system administrator. There are two servers under his strict guidance — a and b. To stay informed about the servers' performance, Polycarpus executes commands "ping a" and "ping b". Each ping command sends exactly ten packets to the server specified in the argument of the command. Executing a program results in two integers x and y (x + y = 10; x, y ≥ 0). These numbers mean that x packets successfully reached the corresponding server through the network and y packets were lost.
Today Polycarpus has performed overall n ping commands during his workday. Now for each server Polycarpus wants to know whether the server is "alive" or not. Polycarpus thinks that the server is "alive", if at least half of the packets that we send to this server reached it successfully along the network.
Help Polycarpus, determine for each server, whether it is "alive" or not by the given commands and their results.
Polycarpus 是一名系统管理员。在他严格管理下有两台服务器——a 和 b。为了实时掌握服务器的运行状况,Polycarpus 会执行命令 "ping a" 和 "ping b"。每次 ping 命令恰好向命令参数中指定的服务器发送 10 个数据包。执行一次命令将返回两个整数 x 和 y(满足 x+y=10;x,y≥0)。这两个数表示:有 x 个数据包成功通过网络抵达对应服务器,而 y 个数据包丢失。
今天 Polycarpus 在工作日中总共执行了 n 次 ping 命令。现在,Polycarpus 希望针对每台服务器判断其是否“存活”。Polycarpus 认为一台服务器是“存活”的,当且仅当发送给该服务器的所有数据包中,至少有一半成功抵达。
请帮助 Polycarpus 根据所给的命令及其执行结果,判断每台服务器是否“存活”。
输入格式
The first line contains a single integer n (2 ≤ n ≤ 1000) — the number of commands Polycarpus has fulfilled. Each of the following n lines contains three integers — the description of the commands. The i-th of these lines contains three space-separated integers t__i, x__i, y__i (1 ≤ t__i ≤ 2; x__i, y__i ≥ 0; x__i + y__i = 10). If t__i = 1, then the i-th command is "ping a", otherwise the i-th command is "ping b". Numbers x__i, y__i represent the result of executing this command, that is, x__i packets reached the corresponding server successfully and y__i packets were lost.
It is guaranteed that the input has at least one "ping a" command and at least one "ping b" command.
第一行包含一个整数 n(2≤n≤1000)—— 表示波利卡普斯执行的命令数量。接下来的 n 行每行包含三个整数,用于描述各条命令。其中第 i 行包含三个以空格分隔的整数 ti、xi、yi(1≤ti≤2;xi,yi≥0;xi+yi=10)。若 ti=1,则第 i 条命令为“ping a”;否则第 i 条命令为“ping b”。数值 xi 和 yi 表示该命令执行的结果,即有 xi 个数据包成功抵达对应服务器,而 yi 个数据包丢失。
保证输入中至少包含一条“ping a”命令和至少一条“ping b”命令。
输出格式
In the first line print string "LIVE" (without the quotes) if server a is "alive", otherwise print "DEAD" (without the quotes).
In the second line print the state of server b in the similar format.
第一行输出字符串 “LIVE”(不带引号),如果服务器 a 处于“存活”状态;否则输出 “DEAD”(不带引号)。
第二行以类似格式输出服务器 b 的状态。
输入输出样例
输入#1
2 1 5 5 2 6 4
输出#1
LIVE LIVE
输入#2
3 1 0 10 2 0 10 1 10 0
输出#2
LIVE DEAD
说明/提示
Consider the first test case. There 10 packets were sent to server a, 5 of them reached it. Therefore, at least half of all packets sent to this server successfully reached it through the network. Overall there were 10 packets sent to server b, 6 of them reached it. Therefore, at least half of all packets sent to this server successfully reached it through the network.
Consider the second test case. There were overall 20 packages sent to server a, 10 of them reached it. Therefore, at least half of all packets sent to this server successfully reached it through the network. Overall 10 packets were sent to server b, 0 of them reached it. Therefore, less than half of all packets sent to this server successfully reached it through the network.
考虑第一个测试用例。共有 10 个数据包被发送至服务器 a,其中 5 个成功到达。因此,发送至该服务器的所有数据包中,至少有一半成功经网络抵达。共有 10 个数据包被发送至服务器 b,其中 6 个成功到达。因此,发送至该服务器的所有数据包中,至少有一半成功经网络抵达。
考虑第二个测试用例。共有 20 个数据包被发送至服务器 a,其中 10 个成功到达。因此,发送至该服务器的所有数据包中,至少有一半成功经网络抵达。共有 10 个数据包被发送至服务器 b,其中 0 个成功到达。因此,发送至该服务器的所有数据包中,成功经网络抵达的比例少于一半。
输入解题思路,AI测评打分。不知道怎么写?