442C】的更多相关文章

题目连接:Codeforces 442C Artem and Array 题目大意:给出一个数组,每次删除一个数.删除一个数的得分为两边数的最小值,假设左右有一边不存在则算作0分. 问最大得分是多少. 解题思路:首先将连续的a,b,c,a > b && c > b的情况将c掉,获得min(a,b)分,这样处理后数组变成一个递増再递减的序列,除了最大和第二大的取不到.其它数字均能够得分. 例子:4 10 2 2 8 #include <cstdio> #include…
题目链接: C. Artem and Array time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Artem has an array of n positive integers. Artem decided to play with it. The game consists of n moves. Each move g…
题目 感谢JLGG的指导! 思路: //把数据转换成一条折线,发现有凸有凹 //有凹点,去掉并加上两边的最小值//无凹点,直接加上前(n-2)个的和(升序)//数据太大,要64位//判断凹与否,若一边等于,一边大于,那中间这个也算是凹进去的,所以判断时要加上等于 //有凹点,去掉并加上两边的最小值 //无凹点,直接加上前(n-2)个的和(升序) //数据太大,要64位 //判断凹与否,若一边等于,一边大于,那中间这个也算是凹进去的,所以判断时要加上等于 #include<stdio.h> #i…
Artem and Array 经过分析我们能发现, 如果对于一个a[ i ] <= a[ i + 1 ] && a[ i ] <= a[ i - 1 ]可以直接删掉. 最后剩下一个先增后减的序列, 除了最大的两个都能加上. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PLL pair<L…
大意: 给定序列$a$, 每次任选$a_i$删除, 得分$min(a_{i-1},a_{i+1})$(无前驱后继时不得分), 求最大得分. 若一个数$x$的两边都比$x$大直接将$x$删除, 最后剩余一个先增后减的序列, 然后按从大到小顺序删除 #include <iostream> #include <algorithm> #include <math.h> #include <cstdio> #include <vector> #includ…
贪心 感觉思路很奥妙 首先我们把那些比两边小的数删掉,因为不删的话两边的数就会选这个数,这样就成了先上升后下降的序列,很明显除了第一第二大的数都能选,然后统计就好了. #include<bits/stdc++.h> using namespace std; typedef long long ll; ; int n, top; ll ans; ll a[N], st[N]; int main() { scanf("%d", &n); ; i <= n; ++i…
题目链接 C. Artem and Array time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Artem has an array of n positive integers. Artem decided to play with it. The game consists of n moves. Each move go…
keepalived配置 之前已经安装完成,接下来我们配置keepalived. 假设我的ip地址如下: server1:192.168.0.150 server2:192.168.0.157 vip:192.168.0.50 在两台服务器上分别执行如下命令: [@server_150 keepalived]# mkdir /etc/keepalived [@server_150 keepalived]# cp /usr/local/keepalived/sbin/keepalived /usr…
一.搜寻命令 1.whereis命令 whereis是搜索系统命令的命令,也就是说,whereis 命令不能搜索普通文件, 而只能搜索系统命令. 命令名称:whereis 英文原意:locate the binary, source, and manual page files for a command. 所在路径:/usr/bin/whereis. 执行权限:所有用户. 功能描述:查找二进制命令.源文件和帮助文档的命令. [root@love2 ~]# whereis whereis whe…