UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#195660#3418. 鹅鸭杀diamond_plus10016ms1364kbC++112.3kb2023-10-18 20:11:392023-10-18 22:30:07

answer

#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <deque>

using namespace std;

#define rd read()
#define int long long

const int N = 1e3 + 10;
const int MOD = 998244353;
const int INF = 0x7fffffff;
const int Fill = 0x3f;
const int FillINF = 0x3f3f3f3f;

void write(int n)
{
    if (n < 0)
    {
        putchar('-');
        n = -n;
    }
    if (n < 10)
    {
        putchar(n + '0');
        return;
    }
    write(n / 10);
    putchar(n % 10 + '0');
    return;
}
void wt(int n, bool o = 1)
{
    write(n);
    if (!o)
    {
        putchar(' ');
    }
    else
    {
        putchar('\n');
    }
}

int read()
{
    char ch;
    int type = 1, n = 0;
    ch = getchar();
    while (ch < '0' || ch > '9')
    {
        if (ch == '-')
        {
            type = -1;
        }
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9')
    {
        n = (n << 1) + (n << 3) + (ch ^ 48);
        ch = getchar();
    }
    return n * type;
}

int n;

struct bird
{
    string name, place;
    bool die, type_;
} a[N];

void solve()
{
    int i, j;
    n = rd;
    for (i = 1; i <= n; i++)
    {
        string s;
        cin >> s;
        a[i].name = s;
        cin >> s;
        cin >> s;
        cin >> s;
        if (s == "duck,")
        {
            a[i].type_ = 1;
        }
        else
        {
            a[i].type_ = 0;
        }
        cin >> s;
        cin >> s;
        cin >> s;
        cin >> s;
        a[i].place = s;
    }
    for (i = 1; i <= n; i++)
    {
        if (a[i].type_)
        {
            for (j = 1; j <= n; j++)
            {
                if (!a[j].type_ && a[j].place == a[i].place)
                {
                    a[j].die = 1;
                }
            }
        }
    }
    for (i = 1; i <= n; i++)
    {
        // cout << a[i].name << ' ' << a[i].place << ' ' << a[i].die << ' ' << a[i].type_ << '\n';
        // printf("% %lld %lld")
        cout << a[i].name << " is " << (a[i].die ? "dead" : "alive") << '\n';
    }
}

signed main()
{
    int T;
    int i, j;
    T = 1;
    while (T--)
    {

        solve();
    }
    return 0;
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 10
Accepted
time: 0ms
memory: 1244kb

input:

1
DnONuKkfsK is a duck, it is at VxdjvTXugQrxHcBy

output:

DnONuKkfsK is alive

result:

ok single line: 'DnONuKkfsK is alive'

Test #2:

score: 10
Accepted
time: 0ms
memory: 1252kb

input:

1
h is a goose, it is at DgPHXhVJtkESkHmf

output:

h is alive

result:

ok single line: 'h is alive'

Test #3:

score: 10
Accepted
time: 0ms
memory: 1248kb

input:

2
HRiAYWN is a goose, it is at EL
dgwgYboiuaytmJOAv is a duck, it is at EL

output:

HRiAYWN is dead
dgwgYboiuaytmJOAv is alive

result:

ok 2 lines

Test #4:

score: 10
Accepted
time: 0ms
memory: 1248kb

input:

2
izNydjl is a goose, it is at qYWlAosa
EISnxurnHqHNKDD is a goose, it is at qYWlAosa

output:

izNydjl is alive
EISnxurnHqHNKDD is alive

result:

ok 2 lines

Test #5:

score: 10
Accepted
time: 0ms
memory: 1252kb

input:

10
NSWzSOl is a duck, it is at VCLAQReUMFYoH
owVUjFuAPuutSaKhLqh is a duck, it is at ZYPmZsegdxJOuB
...

output:

NSWzSOl is alive
owVUjFuAPuutSaKhLqh is alive
iamfqstvZbCYSDhlDnbq is alive
T is alive
zGub is alive...

result:

ok 10 lines

Test #6:

score: 10
Accepted
time: 0ms
memory: 1252kb

input:

10
kjbxCSWpMH is a duck, it is at FIlDOBA
gxRn is a duck, it is at zXofss
vIFtyFL is a duck, it is a...

output:

kjbxCSWpMH is alive
gxRn is alive
vIFtyFL is alive
PFeZj is alive
uEy is alive
qnoZYPzR is alive
Rff...

result:

ok 10 lines

Test #7:

score: 10
Accepted
time: 0ms
memory: 1252kb

input:

10
CdhUNaBieDYujJ is a goose, it is at ftZTshCjDGgjvPZ
e is a duck, it is at HHvP
fnjTJMUYgydjEeAFet...

output:

CdhUNaBieDYujJ is alive
e is alive
fnjTJMUYgydjEeAFet is alive
Vvc is alive
MLHmWVs is alive
AYDTmkf...

result:

ok 10 lines

Test #8:

score: 10
Accepted
time: 6ms
memory: 1364kb

input:

1000
zS is a duck, it is at uZoViqfzXzBHnojfjo
WUzyrypHYFMkE is a goose, it is at RqXtorsLNPVXWX
mbV...

output:

zS is alive
WUzyrypHYFMkE is dead
mbVP is alive
iWelC is alive
DqMTir is alive
Zr is alive
BsHCmmN i...

result:

ok 1000 lines

Test #9:

score: 10
Accepted
time: 5ms
memory: 1364kb

input:

1000
luK is a duck, it is at Jr
kz is a duck, it is at Q
momuTR is a duck, it is at beRModCS
HmqEgsw...

output:

luK is alive
kz is alive
momuTR is alive
HmqEgswLg is dead
uFNEeUULkDT is alive
uQgDGhomNgYQuwndOxKn...

result:

ok 1000 lines

Test #10:

score: 10
Accepted
time: 5ms
memory: 1364kb

input:

1000
IbBJmdORPKZQEUANbGl is a duck, it is at OJplxaPZjvPj
BzokAqyWjUIVWu is a duck, it is at xxYRvKG...

output:

IbBJmdORPKZQEUANbGl is alive
BzokAqyWjUIVWu is alive
tLHbuTjOxzopobuOMg is alive
rLeadcccgsTAuIbpOGU...

result:

ok 1000 lines

Extra Test:

score: 0
Extra Test Passed