QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#522158 | #4330. Točkice | zhouhuanyi | 0 | 1ms | 5784kb | C++14 | 1.0kb | 2024-08-16 19:16:43 | 2024-08-16 19:16:43 |
answer
#include<iostream>
#include<cstdio>
#include<algorithm>
#define N 100000
using namespace std;
int read()
{
char c=0;
int sum=0;
while (c<'0'||c>'9') c=getchar();
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;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 13
Accepted
time: 0ms
memory: 3616kb
input:
1 62 -83
output:
Bara
result:
ok single line: 'Bara'
Test #2:
score: 13
Accepted
time: 1ms
memory: 5784kb
input:
2 0 88 -63 -51
output:
Alenka
result:
ok single line: 'Alenka'
Test #3:
score: 13
Accepted
time: 0ms
memory: 3748kb
input:
3 -27 -76 92 -20 27 -12
output:
Alenka
result:
ok single line: 'Alenka'
Test #4:
score: 13
Accepted
time: 0ms
memory: 3660kb
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: 3748kb
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: 3668kb
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: 3540kb
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: 3672kb
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: 3604kb
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%