摘要: 单调栈可以维护一个长度递增的序列,当新加入的元素不递增时,会把前面的元素截断,使其保持递增由于截断之后大量的元素长度相同,所以没有必要把所有所有元素压入栈,只需将这些元素压缩成一个(用矩阵块和表示!),记录个数,放入栈既可。//#pragma comment(linker, "/STACK:102400000")#include#include#include#include#include#include#include#include#include#include#include#define tree int o,int l,int r#define lson o= 阅读全文
posted @ 2013-09-19 21:42 baoff 阅读(315) 评论(0) 推荐(0) 编辑
摘要: #include#include#include#include#include#include#include#include#include#include#include#define tree int o,int l,int r#define lson og[N];double d[N];int ans[N];void init(){ for(int i=2; i=p[i]; j--) { double tp=log2(p[i]); for(int k=p[i],num=1; k<=j; k*=p[i],num++) ... 阅读全文
posted @ 2013-09-19 17:40 baoff 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 题意,有一个n多边形,且是正多边形,从中任取3点构成一个三角形。告诉你这3个点的坐标,求满足条件的最小的n。基本思路:在n多边形外画一个圆找规律。暴力,从i(3#include#include#include#include#include#include#include#include#include#include#define tree int o,int l,int r#define lson o0?1:-1;}struct Point{ double x,y; int read() { return scanf("%lf%lf",&x,&y); . 阅读全文
posted @ 2013-09-19 17:37 baoff 阅读(305) 评论(0) 推荐(0) 编辑
摘要: 题意说是一个数据库,有n(n=xi,qy>=yi)2 (qx>=xi,qy=yi)4 (qxxi, 当qx==xi时 qy>=yi但是在之前的点必然会出现 qx>xi&&qx=xi,qy>=yi) 的点。树状数组搞定:#include#include#include#include#include#include#include#include#include#include#define LL long long#define inf 0x7ffffffffffffffll#define N 200009using namespace std;L 阅读全文
posted @ 2013-09-19 11:33 baoff 阅读(254) 评论(0) 推荐(0) 编辑
摘要: 题目大意:n个石头围成一圈,每个有权值,现在两只兔子从任意两个石头开始,一个顺时针,一个逆时针跳,可以跳任意远,但是不能超过一圈,要两只兔子所在的石头对应的权值任意时刻都相同,问兔子最多跳多少步。//#pragma comment(linker, "/STACK:16777216")#include#include#include#include#include#include#include#include#include#include#include#define tree int o,int l,int r#define lson o<<1,l,mid# 阅读全文
posted @ 2013-09-19 10:43 baoff 阅读(225) 评论(0) 推荐(0) 编辑