人类智慧题。harmis_yz 不会。

题意

\(\tt{Link}\)

给定一个序列 \(\{a_n\}\),可以进行若干次操作,每次可以选择 \(i,j(1 \le i < j \le n)\),将 \([i,j]\) 之间的数全部变为 \(|a_i - a_j|\),问进行若干次操作后序列之和最大值。

\(\tt{Solution}\)

不容易发现,如果连续对同一对 \(i,j\) 进行两次操作,那么 \([i,j]\) 全为 \(0\)。

然后就做完了。注意需要特判 \(n=2,3\) 的情况,将所有情况取 \(\max\) 即可。

其余情况的答案显然为 \(\max\{a_i\} \times n\)。

CF1763C Another Array Problem的更多相关文章

  1. Maximum sub array

    Here I post a way to solve maximum sub array problem: The problem described like this: here is an ar ...

  2. codechef AUG17 T1 Chef and Rainbow Array

    Chef and Rainbow Array Problem Code: RAINBOWA Chef likes all arrays equally. But he likes some array ...

  3. HDU 5532 / 2015ACM/ICPC亚洲区长春站 F.Almost Sorted Array

    Almost Sorted Array Problem Description We are all familiar with sorting algorithms: quick sort, mer ...

  4. CodeChef Mahesh and his lost array

    Mahesh and his lost array   Problem code: ANUMLA   Submit All Submissions   All submissions for this ...

  5. scau 2015寒假训练

    并不是很正规的.每个人自愿参与自愿退出,马哥找题(马哥超nice么么哒). 放假第一周与放假结束前一周 2015-01-26 http://acm.hust.edu.cn/vjudge/contest ...

  6. HYNB Contest 7:2017 Asia HCMC Vietnam National Programming Contest

    A. Another Query on Array Problem B. Board Covering C. Cumulative Sums 题意 \(A_1=1,A_i=A_{i-1}+sod(A_ ...

  7. CodeForces 构造题专项解题报告

    CodeForces 构造题专项解题报告 \(\newcommand \m \mathbf\)\(\newcommand \oper \operatorname\) \(\text{By DaiRui ...

  8. [LeetCode&Python] Problem 108. Convert Sorted Array to Binary Search Tree

    Given an array where elements are sorted in ascending order, convert it to a height balanced BST. Fo ...

  9. [LeetCode&Python] Problem 905: Sort Array By Parity

    Given an array A of non-negative integers, return an array consisting of all the even elements of A, ...

  10. 1748E Yet Another Array Counting Problem

    1748E Yet Another Array Counting Problem 目录 1748E Yet Another Array Counting Problem 题目大意: 做法 code 题 ...

随机推荐

  1. Linux+Nginx+Php+MariaDB+Redis部署

    目录 工作机制 系统环境描述 部署Nginx 安装 启动 测试并访问 部署PHP 安装 启动 配置Nginx 测试 部署MariaDB 安装 启动 配置php支持 测试 部署Redis 安装 启动 配 ...

  2. NDT算法详解与C++实现

    点云匹配在感知环节是一个很重要的信息获取手段,而其中的算法也有几个比较经典了,例如ICP(Iterative Closest Point,迭代最近点)算法,而本文决定记录学习的是NDT算法,也就是No ...

  3. 从 Git 提交历史生成 Release Note

    发布软件时写 Release Note 算是常规操作,但每次从头手打也有点累,可以考虑从 Git 的提交历史中自动生成. Git 提交信息一般是三段式结构,段落之间使用空行隔开: <subjec ...

  4. Ros环境创建相关!超级简单!!超级详细!!

    1.创建工作空间workspace 其中catkin_ws后面的ws是work_space的简写,指代工作空间 <catkin_ws是你的工作空间的名字,随便取> mkdir -p ~/c ...

  5. Chrome 浏览器 131 版本新特性

    Chrome 浏览器 131 版本新特性 一.Chrome 浏览器 131 版本新特性 1. 在 iOS 上使用 Google Lens 搜索 自 Chrome 126 版本以来,用户可以通过 Goo ...

  6. 一键生成美观的彩页演示+AI的训练过程科普

    一键生成美观彩页 + AI训练揭秘:让你的内容瞬间高大上! 阅读时间: 8分钟 | 字数: 1300+ 你是否曾为制作精美的演示文稿而烦恼?是否对AI的训练过程充满好奇?今天,让我们一起探索如何用AI ...

  7. Nuxt.js 应用中的 webpack:compile 事件钩子

    title: Nuxt.js 应用中的 webpack:compile 事件钩子 date: 2024/11/22 updated: 2024/11/22 author: cmdragon excer ...

  8. Windows之子系统WSL

    [安装] 安装参考:https://learn.microsoft.com/zh-cn/windows/wsl/install-manual#step-4---download-the-linux-k ...

  9. MySQL用错了,99%的人已中招

    在我们日常工作中,可能会经常使用MySQL数据库,因为它是开源免费的,而且性能还不错. 在国内的很多公司中,经常被使用. 但我们在MySQL使用过程中,也非常容易踩坑,不信继续往下看. 今天这篇文章重 ...

  10. S2P销讯通-主数据对于客户关系管理系统的重要性

    由于业务发展,各大企业的业务系统经历了从无到有,从简单到复杂,从而形成了一个又一个的业务系统,比如OA.HR.CRM.ERP等等. 主数据在客户关系管理系统(CRM)中扮演着至关重要的角色.主数据是指 ...