QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#522160#4330. Točkicezhouhuanyi0 1ms5780kbC++141.0kb2024-08-16 19:17:522024-08-16 19:17:52

Judging History

你现在查看的是最新测评结果

  • [2024-08-16 19:17:52]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:5780kb
  • [2024-08-16 19:17:52]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<algorithm>
#define N 100000
using namespace std;
int read()
{
	char c=0;
	int sum=0,f=1;
	while (c!='-'&&(c<'0'||c>'9')) c=getchar();
	if (c=='-') c=getchar(),f=-1;
	while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
	return sum;
}
struct points
{
	int x,y;
	bool operator < (const points &t)const
	{
		return x!=t.x?x<t.x:y<t.y;	
	}
};
points st[N+1],dque[N+1],dque2[N+1];
int n,top,top2;
bool check(points a,points b,points c)
{
	return 1ll*(b.y-a.y)*(c.x-a.x)<=1ll*(c.y-a.y)*(b.x-a.x);
}
bool check2(points a,points b,points c)
{
	return 1ll*(b.y-a.y)*(c.x-a.x)>=1ll*(c.y-a.y)*(b.x-a.x);
}
int main()
{
	n=read();
	for (int i=1;i<=n;++i) st[i].x=read(),st[i].y=read();
	sort(st+1,st+n+1);
	for (int i=1;i<=n;++i)
	{
		while (top>=2&&check(dque[top-1],dque[top],st[i])) top--;
		dque[++top]=st[i];
	}
	for (int i=1;i<=n;++i)
	{
		while (top2>=2&&check2(dque2[top2-1],dque2[top2],st[i])) top2--;
		dque2[++top2]=st[i];
	}
	puts(((top+top2+n)&1)?"Bara":"Alenka");
	return 0;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 13
Accepted
time: 0ms
memory: 3728kb

input:

1
62 -83

output:

Bara

result:

ok single line: 'Bara'

Test #2:

score: 13
Accepted
time: 1ms
memory: 5780kb

input:

2
0 88
-63 -51

output:

Alenka

result:

ok single line: 'Alenka'

Test #3:

score: 13
Accepted
time: 0ms
memory: 3676kb

input:

3
-27 -76
92 -20
27 -12

output:

Alenka

result:

ok single line: 'Alenka'

Test #4:

score: 13
Accepted
time: 0ms
memory: 3616kb

input:

4
-29 19
23 -52
-69 44
25 -85

output:

Alenka

result:

ok single line: 'Alenka'

Test #5:

score: 13
Accepted
time: 0ms
memory: 3660kb

input:

4
-45 -24
-1 -84
-61 86
-82 32

output:

Alenka

result:

ok single line: 'Alenka'

Test #6:

score: 13
Accepted
time: 0ms
memory: 3652kb

input:

4
-30 -50
23 -34
-59 79
5 19

output:

Alenka

result:

ok single line: 'Alenka'

Test #7:

score: 13
Accepted
time: 0ms
memory: 3680kb

input:

4
98 -68
-34 53
-73 62
97 25

output:

Bara

result:

ok single line: 'Bara'

Test #8:

score: 13
Accepted
time: 0ms
memory: 3592kb

input:

4
-99 -36
33 74
83 97
35 22

output:

Alenka

result:

ok single line: 'Alenka'

Test #9:

score: 0
Wrong Answer
time: 0ms
memory: 3728kb

input:

4
20 -99
75 27
-2 55
-41 97

output:

Alenka

result:

wrong answer 1st lines differ - expected: 'Bara', found: 'Alenka'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%