比赛 东方版NOIP模拟赛 评测结果 AAATTTTTTA
题目名称 Yukari 最终得分 40
用户昵称 haah 运行时间 6.004 s
代码语言 C++ 内存使用 4.89 MiB
提交时间 2015-10-28 19:38:45
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
using namespace std;
typedef long long LL;
const LL maxn=1e5+5;
inline LL read(){
	LL x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
LL N;
LL dx,dr,ux,ur;
struct node{
	LL x,y;
	LL mx,my;
	LL nowx,nowy;
	LL jud(LL t){
		LL tmpx=x+t*mx;
		LL tmpy=y+t*my;
		if(dx<=tmpx&&tmpx<=ux&&dr<=tmpy&&tmpy<=ur){
			return 1;
		}
		else return 0;
	}
}a[maxn];
LL ANS,T;
int main(){
	freopen("camera.in","r",stdin);
	freopen("camera.out","w",stdout);
	N=read(); dx=read(); dr=read(); ux=read(); ur=read();
	for(LL i=1;i<=N;i++){
		a[i].x=read(); a[i].y=read();
		a[i].mx=read(); a[i].my=read();
		a[i].nowx=a[i].x; a[i].nowy=a[i].y;
	}
	for(LL t=0;t<=4000;t++){
		LL cnt=0;
		for(LL i=1;i<=N;i++){
			cnt+=a[i].jud(t);
		}
		if(cnt>ANS){
			ANS=cnt;
			T=t;
		}
	}
	cout<<T;
	return 0;
}