bdfz_2024_summer/day1/PreSim/总结.md
2024-08-03 08:03:06 +08:00

72 lines
691 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 区间最值求和
## 题目描述
给一个长度 $n$ 的序列 $a$,求:
$$
\sum_{l=1}^n\sum_{r=l}^n max(a[l...r])
$$
## 输入格式
第一行1个整数 $n$
第二行 $n$ 个整数 $a[1,2,...,n]$
## 输出格式
输出1个整数代表答案
## 样例 #1
### 样例输入 #1
```
4
2 1 3 4
```
### 样例输出 #1
```
30
```
## 样例 #2
### 样例输入 #2
```
5
4 5 7 2 4
```
### 样例输出 #2
```
87
```
## 样例 #3
### 样例输入 #3
```
见下发样例
```
### 样例输出 #3
```
见下发样例
```
## 提示
对于所有数据,$1\le n,a[i]\le 10^6$
subtask1(20pts)$n \le 5000$
subtask2(20pts)$a[i]\le 50$
subtask4(60pts):无特殊限制