goal
线段树进阶,主席树,莫队,相似kmp,悬线,单调栈,单调队列,ac自动机,后缀数组,后缀自动机
double three_devide(double low,double up)
{
double m1,m2;
while(up-low>=eps)
{
m1=low+(up-low)/;
m2=up-(up-low)/;
if(f(m1)<=f(m2))
low=m1;
else
up=m2;
}
return (m1+m2)/;
}
单调队列
#include <iostream>
using namespace std;
const int N = ; // 数组长度的最大值
struct data {
int id, value;
} q[N];
int a[N], n, k, l, r;
int main() {
scanf("%d%d", &n, &k);
for (int i = ; i < n; ++i) {
scanf("%d", &a[i]);
}
l = , r = -; // 队首和队尾在数组 q 中的下标
for (int i = ; i < n; ++i) {
while (l <= r && q[l].id <= i - k) l++; // 不断弹出不符合要求的队首元素
while (l <= r && q[r].value <= a[i]) r--; // 不断弹出不符合要求的队尾元素
q[++r] = {i, a[i]}; // 将当前元素入队
printf("%d %d\n", i, q[l].value); // 输出当前滑动窗口内的最大值
}
return ;
}
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e6+;
int a[maxn],out,i,l=,r=-;
char ch[];
struct data
{
int id,value;
}q[maxn]; int main()
{
scanf("%s",ch);
while(scanf("%s",ch))
{
if(ch[]=='E')return ;
else if(ch[]=='O')
{
if(l>r)printf("%d\n",-);
else
{
out++;
while(l<=r&&q[l].id<out)l++;
if(l>r)printf("%d\n",-);
else printf("%d\n",q[l].value);
}
}
else if(ch[]=='I')
{
int x;
scanf("%d",&x);
a[i++]=x;
while(l<=r&&q[r].value<x)r--;
q[++r]={i-,x};
printf("%d\n",q[l].value);
}
}
return ;
}
https://oi-wiki.org/
2019ccpc厦门+?
try a try,拿个牌子叭(*╹▽╹*)
...
goal的更多相关文章
- maven install Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project web_nanchang
maven打包成war时,报错:Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default- ...
- Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (dist) on project hadoop-kms: An Ant BuildException has occured
编译cdh版hadoop2.5.0出现的问题 系统: CentOs66 64位 JDK:1.7 Maven: 3.0.5 Protobuf: libprotoc 2.5.0 编译命令: mvn pac ...
- Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project LogTest: Compilation failure -> [Help 1]
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default ...
- [ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.3.1:
security-sdk-1.0.jar已经存在于D:/secServerSDK-test/src/main/resources/lib下 报错如下: xxxxxx@xxxxxxxx /d/secSe ...
- [ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:create (default-cli) on project standalone-pom: Unable to parse configuration of 3: mojo org.apache.maven.plugins:
问题: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:create (defau ...
- Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.2.3:run (default-cli) on project Maven_WebTest: Execution default-cli of goal org.codehaus.cargo:cargo-maven2-plugin:1.2.3:run failed: C
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...
- Failed to execute goal org.codehaus.mojo:rpm-maven-plugin:2.1.1:rpm (default) on project **
maven编译项目时报错:Failed to execute goal org.codehaus.mojo:rpm-maven-plugin:2.1.1:rpm (default) on projec ...
- maven 错误No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format
[INFO] Scanning for projects... [INFO] ------------------------------------------------------------- ...
- [ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.3.1:jar (default-jar) on
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.3.1:jar (default-jar) on ...
- maven install 报错Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project*****
[ERROR]Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-co ...
随机推荐
- 推荐Java五大微服务器及其代码示例教程
来源素文宅博客:http://blog.yoodb.com/yoodb/article/detail/1339 微服务越来越多地用于开发领域,因为开发人员致力于创建更大,更复杂的应用程序,这些应用程序 ...
- CMDB连接方式
1.agent agent (放在每台客户端服务器上,定时任务) 脚本演示 # 采集本机的信息 执行命令 import subprocess v1 = subprocess.getoutput('ip ...
- 【Elasticsearch 7 探索之路】(三)倒排索引
上一篇,我们介绍了 ES 文档的基本 CURE 和批量操作.我们都知道倒排索引是搜索引擎非常重要的一种数据结构,什么是倒排索引,倒排索引的原理是什么. 1 索引过程 在讲解倒排索引前,我们先了解索引创 ...
- git Lab ssh方式拉取代码失败
gitLab在linux上已经安装好了, 在配置项目的时候报如下异常 使用http方式没问题, 但是用ssh方式设置repository URL 提示资源库不存在. returned status c ...
- nyoj 56-阶乘因式分解(一)(数学)
56-阶乘因式分解(一) 内存限制:64MB 时间限制:3000ms Special Judge: No accepted:15 submit:16 题目描述: 给定两个数m,n,其中m是一个素数. ...
- nyoj 399-整除个数 (整除)
399-整除个数 内存限制:64MB 时间限制:3000ms 特判: No 通过数:9 提交数:18 难度:1 题目描述: 1.2.3… …n这n(0<n<=1000000000)个数中有 ...
- 关闭zabbix 告警
1. 到触发器配置界面开启Allow manual close. (可能需要在连接的模板处修改) 2. 永久关闭告警,即disable该触发器.
- Redis为什么是单线程、及高并发快的3大原因详解
Redis的高并发和快速原因 1.redis是基于内存的,内存的读写速度非常快: 2.redis是单线程的,省去了很多上下文切换线程的时间: 3.redis使用多路复用技术,可以处理并发的连接.非阻塞 ...
- LoadRunner中的90%响应时间
LoadRunner中的90%响应时间是什么意思?这个值在进行性能分析时有什么作用? 为什么要有90%用户响应时间? 这个跟超女.舞林大会等比赛那样在比赛后都要去掉一个最高分一个最低分在取平均值有点类 ...
- leetcode 114二叉树转换成链表
解法一 可以发现展开的顺序其实就是二叉树的先序遍历.算法和 94 题中序遍历的 Morris 算法有些神似,我们需要两步完成这道题. 将左子树插入到右子树的地方 将原来的右子树接到左子树的最右边节点 ...