记录编号 |
204887 |
评测结果 |
AAAAAAAAAA |
题目名称 |
[SYOI 2015] Asm.Def的一秒 |
最终得分 |
100 |
用户昵称 |
dashgua |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.234 s |
提交时间 |
2015-11-04 18:03:16 |
内存使用 |
2.60 MiB |
显示代码纯文本
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <iostream>
#include <algorithm>
template<class Num>void read(Num &x)
{
char c; int flag = 1;
while((c = getchar()) < '0' || c > '9')
if(c == '-') flag *= -1;
x = c - '0';
while((c = getchar()) >= '0' && c <= '9')
x = (x<<3) + (x<<1) + (c-'0');
x *= flag;
return;
}
template<class Num>void write(Num x)
{
if(!x) {putchar('0');return;}
if(x < 0) putchar('-'), x = -x;
static char s[20];int sl = 0;
while(x) s[sl++] = x%10 + '0',x /= 10;
while(sl) putchar(s[--sl]);
}
const int maxn = 1e5 + 20;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
#define X first
#define Y second
typedef std::pair<long long,long long> Node;
int N, a, b, c, d, ans;
Node F[maxn];
long long Min[maxn];
bool cmp(const Node &A,const Node &B)
{
return A.X == B.X ? A.Y > B.Y : A.X < B.X;
}
int main()
{
freopen("asm_second.in","r",stdin);
freopen("asm_second.out","w",stdout);
read(N);
read(a), read(b), read(c), read(d);
for(int i = 1; i <= N; i++)
{
long long X, Y;
read(X), read(Y);
F[i] = std::make_pair(X, Y);
}
F[++N] = std::make_pair(0, 0);
for(int i = 1; i <= N; i++)
{
long long X = F[i].X, Y = F[i].Y;
F[i] = std::make_pair(X * c - Y * d, Y * b - X * a);
}
std::sort(F + 1, F + N + 1, cmp);
for(int i = 1; i <= N; i++) Min[i] = LINF;
for(int i = 1; i <= N; i++)
{
if(F[i].X < 0 || F[i].Y < 0) continue;
long long Y = F[i].Y, *G;
G = std::lower_bound(Min + 1, Min + N + 1, Y);
*G = Y, ans = std::max(G - Min, ans);
}
write(ans - 1);
fclose(stdin);
fclose(stdout);
return 0;
}