A. System Administrator

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.

Input
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 ti, xi, yi (1 ≤ ti ≤ 2; xi, yi ≥ 0; xi + yi = 10). If ti = 1, then the i-th command is “ping a”, otherwise the i-th command is “ping b”. Numbers xi, yi represent the result of executing this command, that is, xi packets reached the corresponding server successfully and yi packets were lost.

It is guaranteed that the input has at least one “ping a” command and at least one “ping b” command.

Output
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.

Examples
inputCopy
2
1 5 5
2 6 4
outputCopy
LIVE
LIVE
inputCopy
3
1 0 10
2 0 10
1 10 0
outputCopy
LIVE
DEAD

#include <iostream>
using namespace std;

int main()
{
    int n;
    while(cin >> n)
    {
        int asumx = 0;
        int asumy = 0;
        int bsumx = 0;
        int bsumy = 0;
        for(int i = 0; i < n; ++i)
        {
            int t, x, y;
            cin >> t >> x >> y;
            if(t == 1)
            {
                asumx += x;
                asumy += y;
            }
            else
            {
                bsumx += x;
                bsumy += y;
            }
        }
        if(asumx >= asumy)
            cout << "LIVE" << '\n';
        else
            cout << "DEAD" << '\n';
        if(bsumx >= bsumy)
            cout << "LIVE" << '\n';
        else
            cout << "DEAD" << '\n';
    }
    return 0;
}

全部评论

相关推荐

不愿透露姓名的神秘牛友
11-29 12:19
点赞 评论 收藏
分享
暴走萝莉莉:这是社招场吧,作为HR说个实话:这个维护关系的意思是要有政府资源,在曾经的工作中通过人脉资源拿下过大订单的意思。这个有相关管理经验,意思也是真的要有同岗位经验。应酬什么的对于业务成交来说就算不乐意也是常态,就是要求说话好听情商高,酒量好。
点赞 评论 收藏
分享
11-09 01:22
已编辑
东南大学 Java
高级特工穿山甲:羡慕,我秋招有家企业在茶馆组织线下面试,约我过去“喝茶详谈”😢结果我去了发现原来是人家喝茶我看着
点赞 评论 收藏
分享
评论
点赞
收藏
分享
正在热议
# 25届秋招总结 #
443331次浏览 4520人参与
# 春招别灰心,我们一人来一句鼓励 #
42187次浏览 537人参与
# 北方华创开奖 #
107468次浏览 600人参与
# 地方国企笔面经互助 #
7973次浏览 18人参与
# 同bg的你秋招战况如何? #
77166次浏览 569人参与
# 实习必须要去大厂吗? #
55811次浏览 961人参与
# 阿里云管培生offer #
120419次浏览 2220人参与
# 虾皮求职进展汇总 #
116310次浏览 887人参与
# 如果你有一天可以担任公司的CEO,你会做哪三件事? #
11683次浏览 289人参与
# 实习,投递多份简历没人回复怎么办 #
2454962次浏览 34861人参与
# 提前批简历挂麻了怎么办 #
149927次浏览 1978人参与
# 在找工作求抱抱 #
906096次浏览 9421人参与
# 如果公司给你放一天假,你会怎么度过? #
4762次浏览 55人参与
# 你投递的公司有几家约面了? #
33209次浏览 188人参与
# 投递实习岗位前的准备 #
1196037次浏览 18550人参与
# 机械人春招想让哪家公司来捞你? #
157648次浏览 2267人参与
# 双非本科求职如何逆袭 #
662384次浏览 7397人参与
# 发工资后,你做的第一件事是什么 #
12806次浏览 62人参与
# 工作中,努力重要还是选择重要? #
35906次浏览 384人参与
# 简历中的项目经历要怎么写? #
86937次浏览 1516人参与
# 参加完秋招的机械人,还参加春招吗? #
20153次浏览 240人参与
# 我的上岸简历长这样 #
452074次浏览 8089人参与
牛客网
牛客企业服务