YY_More

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2011年11月10日

摘要: 心血来潮花了一上午做了这道恶心死人的高精度。展示一下打了各种补丁的程序。type gj=record len:longint; data:array[1..1000]of longint; end;const num:array[0..3]of integer=(1,10,100,1000);var x,ans:gj; c:char; s:string; n,i,len,L:longint; flag:boolean;procedure change(var x:gj);var i,j:longint;begin j:=0; fillch... 阅读全文
posted @ 2011-11-10 13:32 YY_More 阅读(231) 评论(0) 推荐(0) 编辑

2011年8月3日

摘要: 这道题目其实就是裸的凸完全单调性,显然是O(nlogn)的算法。但是这个倒霉题目卡了我2天。昨天写的程序WA了,所以今天完全推倒重写,但是居然又WA了。太蛋疼了,居然用long double才够用,还要考虑蛋疼的精度问题,最后好不容易改对了,结果又被lld和I64d虐了。最蛋疼的是,当我发现直接成为rank1之后,想优化一下代码,结果用的是小号交的。。。就这么被马甲虐了,怎么也上不去了。。。//By YY_More#include<cstdio>#include<cstring>#include<cmath>#include<algorithm> 阅读全文
posted @ 2011-08-03 15:01 YY_More 阅读(568) 评论(0) 推荐(0) 编辑

2011年8月1日

摘要: 还是四边形不等式的题目。//By YY_More#include<cstdio>int x[1001],sum[1001],n,m,temp,s[1001][1001],f[1001][1001];inline int cal(int a,int b){ return x[b]-x[a-1]-sum[a-1]*(sum[b]-sum[a-1]);} int main(){ while (~scanf("%d%d",&n,&m)){ if (n==0) break; sum[0]=0;x[0]=0; for(int i=1;i<=n;i++) 阅读全文
posted @ 2011-08-01 13:41 YY_More 阅读(273) 评论(0) 推荐(0) 编辑

摘要: 经典的四边形不等式优化,可以达到O(VP)。不过网上很多人的程序对四边形不等式应用的不好,他们那么写是达不到O(VP)的。//By YY_More#include<cstdio>int x[301],sum[301],f[35][310],s[35][310],V,P,temp; inline int cal(int a,int b){ int k=(a+b)/2; return -sum[k-1]+sum[a-1]+sum[b]-sum[k]+x[k]*(k+k-a-b);} int main(){ scanf("%d%d",&V,&P); f 阅读全文
posted @ 2011-08-01 11:05 YY_More 阅读(280) 评论(0) 推荐(0) 编辑

2011年7月31日

摘要: 先排序扫一遍把不需要考虑的土地忽略掉,之后就可以四边形不等式或者斜率优化了.//By YY_More#include<cstdio>#include<algorithm>using namespace std;struct earth{ long long x,y;} p[50010],s[50010];bool cmp(earth a,earth b){ if (a.x==b.x) return a.y<b.y; return a.x<b.x;} long long F[50010];int D[50010],N,top,L,R;inline long l 阅读全文
posted @ 2011-07-31 10:48 YY_More 阅读(483) 评论(0) 推荐(0) 编辑

摘要: 很多斜率优化的论文里都有这道题.//By YY_More#include<cstdio>struct point{ long long x,y;} now,D[1000010];int N,X[1000010],C,L,R;long long sumP[1000010],sumXP[1000010],W[1000010];inline long long xmul(point a,point b,point c){ return (b.x-a.x)*(c.y-a.y)-(b.y-a.y)*(c.x-a.x);} int main(){ scanf("%d",&a 阅读全文
posted @ 2011-07-31 10:45 YY_More 阅读(383) 评论(0) 推荐(0) 编辑

摘要: 我发现斜率优化的大多都是模板题。//By YY_More#include<cstdio>struct point{ long long x,y;} now,D[50010];int L,R,N,W;long long C[500010];inline long long xmul(point a,point b,point c){ return (b.x-a.x)*(c.y-a.y)-(b.y-a.y)*(c.x-a.x);} int main(){ scanf("%d%d",&N,&W); for (int i=1;i<=N;i++){ 阅读全文
posted @ 2011-07-31 09:04 YY_More 阅读(936) 评论(0) 推荐(0) 编辑

2011年7月30日

摘要: 裸的斜率优化,去年的APIO怎么有此等水题。//By YY_More#include<cstdio>struct point{ long long x,y;} now,D[1000010]; long long sum[1000010]; int L,R,n,a,b,c;inline long long xmul(point p,point q,point s){ return (q.x-p.x)*(s.y-p.y)-(q.y-p.y)*(s.x-p.x);} int main(){ scanf("%d",&n); scanf("%d%d%d& 阅读全文
posted @ 2011-07-30 20:30 YY_More 阅读(430) 评论(0) 推荐(0) 编辑

摘要: 裸斜率优化,不解释//By YY_More#include<cstdio>struct point{ int x,y;} D[500010],now;int sum[500010];int N,M,L,R;int xmul(point a,point b,point c){ return (b.x-a.x)*(c.y-a.y)-(b.y-a.y)*(c.x-a.x);} int main(){ while (~scanf("%d%d",&N,&M)){ sum[0]=0; for (int i=1;i<=N;i++){ scanf(&quo 阅读全文
posted @ 2011-07-30 20:29 YY_More 阅读(285) 评论(0) 推荐(0) 编辑

摘要: 斜率优化基础//By YY_More#include<cstdio>#include<algorithm>using namespace std;struct node{ int x,y;} now,stack[100010];double ans;int n,k,sum[100010],head,tail;long long xmul(node a,node b,node c){ return (long long)((b.x-a.x)*(c.y-a.y)-(b.y-a.y)*(c.x-a.x));} int main(){ while(~scanf("%d 阅读全文
posted @ 2011-07-30 20:27 YY_More 阅读(204) 评论(0) 推荐(0) 编辑