ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#195218 | #3418. 鹅鸭杀 | fghking | 100 | 28ms | 9456kb | C++ | 993b | 2023-10-18 18:38:21 | 2023-10-18 21:58:21 |
answer
#include<bits/stdc++.h>
using namespace std;
string a[1010][1010],nameplace[1010],name[1010];
int n, sum[1010],cnt;
bool f[1010], g[1010];
char s[1010];
map <string,int> mpp,mpn;
int main () {
cin >> n;
for (int i = 1; i <= n; i++) {
string op, op1, op2, op3;
scanf("%s", s);
op1=s;
scanf("%s", s);
scanf("%s", s);
scanf("%s", s);
op2=s;
scanf("%s", s);
scanf("%s", s);
scanf("%s", s);
scanf("%s", s);
op3 = s;
name[i]=op1;
mpn[op1]=i;
if(mpp[op3]==0){
cnt++;
mpp[op3]=cnt;
nameplace[cnt]=op3;
}
if(op2=="duck,"){
g[mpp[op3]]=1;
for(int i=1;i<=sum[mpp[op3]];i++){
f[mpn[a[mpp[op3]][i]]]=1;
}
}else{
sum[mpp[op3]]++;
a[mpp[op3]][sum[mpp[op3]]]=op1;
if(g[mpp[op3]]==1){
f[i]=1;
}
}
// cout<<op1<<" "<<op2<<" "<<op3<<endl;
}
for(int i=1;i<=n;i++){
cout<<name[i]<<" is ";
if(f[i]==1){
cout<<"dead"<<endl;
}else{
cout<<"alive"<<endl;
}
}
return 0;
}
Details
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 6ms
memory: 9260kb
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: 4ms
memory: 9268kb
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: 9264kb
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: 2ms
memory: 9264kb
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: 5ms
memory: 9268kb
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: 9268kb
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: 9268kb
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: 4ms
memory: 9452kb
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: 4ms
memory: 9456kb
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: 3ms
memory: 9456kb
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