摘要: 最基本的树状数组操作,卡了半天,是因为为了节省几KB内存,树状数组用了short存,导致结果错误!!#include<stdio.h>#include<string.h>short a[100005];int c[100005],n;int lowbit(int i){ return i&(-i);}void add(int i,int v){ while (i<=n) { c[i]+=v; i+=lowbit(i); }}int sum(int i){ int s=0; while (i>0) { s+=c[i]; i-=lowbit(i); } 阅读全文
posted @ 2011-07-28 21:10 laputastar 阅读(251) 评论(0) 推荐(0) 编辑
摘要: Prime PathTime Limit:1000MSMemory Limit:65536KTotal Submissions:6010Accepted:3440DescriptionThe ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices.— It is a matter of security to 阅读全文
posted @ 2011-07-28 12:56 laputastar 阅读(178) 评论(0) 推荐(0) 编辑