zhx'code1
void dandiao() {
int front=,tail=;
for (int a=;a<=k;a++)
{
while (tail>=front && z[a]<q[tail][])
tail--;
tail++;
q[tail][]=z[a];q[tail][]=a;
}
for (int a=k+;a<=n;a++)
{
while (tail>=front && z[a]<q[tail][])
tail--;
tail++;
q[tail][]=z[a];q[tail][]=a;
if (q[front][]==a-k) front++;
}
}
class queue {
int front=,tail=,q[];
void enque(int x) { q[++tail]=x;}
void deque() { front++;}
bool empty() { return front>tail;}
int front1() { return q[front];
}
class stack {
int size=,s[];
void enque(int x) { s[++size]=x;}
void deque() { size--;}
bool empty() { return size!=;}
int front() { return s[size];
}
#include<queue>
using namespace std;
priority_queue<int> heap;
heap.push(-x);//logn
heap.pop();//logn
heap.top();//
heap.size();//
heap.empty();//
struct rec {
int a;
bool operator<(const rec ¬_gg)const {
return a<not_gg.a;
}
}a,b,z[];
sort(z,z+n);
bool operator<(const rec &gg1,const rec &gg2){
return gg1.a<gg2.a;
}
priority_queue<rec> heap;
int getf(int p) {
if (f[p]==p) return p;
else return f[p]=getf(f[p]);
}
void merge(int p1,int p2) {
int f1=getf(p1);
int f2=getf(p2);
if (f1!=f2) {
if (size[f1]>size[f2]) swap(f1,f2);
f[f1]=f2;
size[f2]+=size[f1];
}
}
west14.openjudge.cn/
const int maxn=;
int z[maxn],sum[maxn<<];//maxn*4
//rt <<1 =rt*2
//rt<<1|1=rt*2+1
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
void update(int rt) {
sum[rt]= sum[rt<<] + sum[rt<<|];
}
void build(int l,int r,int rt) {
if (l==r) {
sum[rt]=z[l];
return;
}
int m=(l+r)>>;//(l+r)/2 [l,m] [m+1,r]
build(lson);
build(rson);
update(rt);
}
build(,n,);
int query(int l,int r,int rt,int nowl,int nowr) {
if (nowl<=l && r<=nowr) return sum[rt];
int m=(l+r)>>;
int ans=;
if (nowl<=m) ans+=query(lson,nowl,nowr);
if (m<nowr) ans+=query(rson,nowl,nowr);
return ans;
}
query(,n,,l,r);
void modify(int l,int r,int rt,int p,int v) {
if (l==r) {
sum[rt]=v;
return;
}
int m=(l+r)>>;
if (p<=m) modify(lson,p,v);
else modify(rson,p,v);
update(rt);
}
modify(,n,,p,v);
忠诚
const int maxn=;
int z[maxn],sum[maxn<<];//maxn*4
//rt <<1 =rt*2
//rt<<1|1=rt*2+1
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
void update(int rt) {
sum[rt]= sum[rt<<] + sum[rt<<|];
}
void color(int l,int r,int rt,int c) {
col[rt] = c;
sum[rt] = c*(r-l+);
}
void push_col(int l,int r,int rt) {
if (col[rt]) {
int m=(l+r)>>;
color(lson,col[rt]);
color(rson,col[rt]);
col[rt]=;
}
}
void build(int l,int r,int rt) {
col[rt]=;
if (l==r) {
sum[rt]=z[l];
return;
}
int m=(l+r)>>;//(l+r)/2 [l,m] [m+1,r]
build(lson);
build(rson);
update(rt);
}
build(,n,);
int query(int l,int r,int rt,int nowl,int nowr) {
if (nowl<=l && r<=nowr) return sum[rt];
push_col(l,r,rt);
int m=(l+r)>>;
int ans=;
if (nowl<=m) ans+=query(lson,nowl,nowr);
if (m<nowr) ans+=query(rson,nowl,nowr);
return ans;
}
query(,n,,l,r);
void modify(int l,int r,int rt,int nowl,int nowr,int v) {
if (nowl<=l && r<=nowr) {
color(l,r,rt,v);
return;
}
push_col(l,r,rt);
int m=(l+r)>>;
if (nowl<=m) modify(lson,nowl,nowr,v);
if (m<nowr) modify(rson,nowl,nowr,v);
update(rt);
}
modify(,n,,l,r,v);
notonlysuccess.com
notonlysuccess
while (scanf("%s%s",gg1,gg2) != EOF) {
}
scanf("%dgg%d",&a,&b);
scanf("%d-%d-%d %d:%d:%d",&year,&month,&day,&hour,&minute,&second);
#ifdef WIN32
#define LL "%I64d"
#else
#define LL "%lld"
#endif
int x;scanf("%d",&x);
long long x;scanf(LL,&x);
double x;scanf("%lf",&x);
char x[];scanf("%s",x);
scanf("%s",x+);
char x;scanf("%c",&x);
scanf("%d" LL,&x,&y);
printf("%.8lf\n",x);
printf("% 8d\n",x);
scanf("%d\n%d",&x,&y);
string;
int y[];
int *z=y+;
z[-] y[];
zhx'code1的更多相关文章
- zhx and contest (枚举 + dfs)
zhx and contest Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) ...
- zhx's contest (矩阵快速幂 + 数学推论)
zhx's contest Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) To ...
- HDU - 5187 - zhx's contest (高速幂+高速乘)
zhx's contest Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) To ...
- mysql 安装过程中的错误:my-template.ini could not be processed and written to XXX\my.ini.Error code-1
安装mysql的过程中,在最后配置mysql时,提示错误:Configuration file tmeplate E:\编程\MySQL\my-template.ini could not be pr ...
- HDOJ 5188 zhx and contest 贪婪+01背包
zhx and contest Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) ...
- HDU - 5186 - zhx's submissions (精密塔尔苏斯)
zhx's submissions Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others ...
- HDU 5186 zhx's submissions (进制转换)
Problem Description As one of the most powerful brushes, zhx submits a lot of code on many oj and mo ...
- 【HDU5187】zhx's contest
[问题描述] 作为史上最强的刷子之一,zhx的老师让他给学弟(mei)们出n道题.zhx认为第i道题的难度就是i.他想要让这些题目排列起来很漂亮. zhx认为一个漂亮的序列{ai}下列两个条件均需满足 ...
- HDU5187 zhx's contest
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission ...
随机推荐
- 设置oracle编辑的快捷方式
打开PLSQL Developer: 中文版:[工具]-->[首选项]-->[用户界面]-->[编辑器],在右侧界面往下拉找到[自动替换],点击[编辑],就可以自定义想要的快捷方式了 ...
- MySQL优化具体
1. 查询与索引优化分析 在优化MySQL时,通常需要对数据库进行分析,常见的分析手段有慢查询日志,profiling分析,EXPLAIN分析查询,以及show命令查询系统状态及系统变量,通过定位分析 ...
- springboot访问jsp页面
1.新建springboot项目,选择以war包的方式package; image 2.勾选Web模块,DevTools可不选(用作热部署,不影响运行) image 3.创建完成后,项目结构如 ...
- go语言中strings包中的Trim函数的作用是什么
答:Trim函数原型如下: func Trim(s string, cutset string) string 去掉字符串s中首部以及尾部与字符串cutset中每个相匹配的字符,如: s=" ...
- openwrt如何查看当前使用的硬件平台
答:输入cat /tmp/sysinfo/board_name即可获取
- Python学习札记(十一) Function2 函数定义
参考:定义函数 Note: 先看一段代码实例(Barefoot topo.py): def read_topo(): nb_hosts = 0 nb_switches = 0 links = [] w ...
- gcc编译出错---make[5]: *** [s-attrtab] Killed
内存不足导致的编译出错,解决方法是增加swapfile. root@ubuntu:home# swapon -s Filename Type Size Used ...
- RNAseq 流程
https://github.com/twbattaglia/RNAseq-workflow
- java 获取今天,昨天,上个月的日期
获取今天,昨天,上个月的日期 的方法: Calendar cal = Calendar.getInstance(); //获取今天的日期 cal.setTime(new Date()); int ye ...
- asp.net mvc Route路由映射.html后缀 404错误
[HttpGet] [Route("item/{id:long:min(1)}.html")] 首先RouteConfig配置文件RegisterRoutes方法添加以下代码: r ...