UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#195407#3418. 鹅鸭杀Sun_wtup10012ms1560kbC++1.7kb2023-10-18 19:00:202023-10-18 22:10:11

answer

#include <bits/stdc++.h>
//#include <windows.h>
//#include <psapi.h>
//#include <time.h>
using namespace std;
#define debug(x) std::cerr<<#x<<'='<<x<<std::endl
string name[1005];
string place[1005];
string x[1005];
map <string, bool> die;
map <string, bool> goose;
map <string, bool> duck;
signed main()
{
//  freopen("Untitled-2.in","r",stdin);
//  freopen("Untitled-2.out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	string s;
//	string x;
//  clock_t start,end;    //定义clock_t变量
//  start = clock();      //开始时间
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> name[i] >> s >> s >> x[i];
//		cout << s;
		if (x[i] == "goose,") {
//			cout << "+";
			cin >> s >> s >> s >> place[i];
			goose[place[i]] = 1;
//			cout << goose[place[i]] << ' ';
		}
		else {
			cin >> s >> s >> s >> place[i];
			duck[place[i]] = 1;
//			cout << duck[place[i]] << ' ';
		}
//		cout << x;
		die[place[i]] = 1;
//		cout << place[i] << ' ';
//		cout << goose[place[i]] << " " << duck[place[i]] << '\n';
		if (goose[place[i]] == 1 and duck[place[i]] == 1) {
//			cout << "+";
			die[place[i]] = 0;
		}
//		cout << die[place[i]] << '\n';
	}
//  end = clock();   //结束时间
//  cout<<"time = "<<double(end-start)/CLOCKS_PER_SEC<<"s"<<endl;//输出时间
	for (int i = 1; i <= n; i++) {
		if (die[place[i]] == 0 and x[i] == "goose,") {
			cout << name[i] << " is " << "dead\n";
		}
		else {
			cout << name[i] << " is " << "alive\n";
		}
	}
//  HANDLE hd = GetCurrentProcess();
//  PROCESS_MEMORY_COUNTERS pmc;
//  GetProcessMemoryInfo(hd, &pmc, sizeof(pmc));
//  printf("%lf", double(pmc.WorkingSetSize) / 1024 / 1024);//单位MiB
	
//  fclose(stdin);
//  fclose(stdout);
	return 0;
}

详细

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

Test #1:

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

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: 1280kb

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: 1288kb

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: 1284kb

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: 1ms
memory: 1288kb

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: 1288kb

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: 1ms
memory: 1288kb

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: 3ms
memory: 1552kb

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: 3ms
memory: 1560kb

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: 4ms
memory: 1560kb

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