题意 给一个数列\(a\),定义\(f(l,r)\)为\(b_1, b_2, \dots, b_{r - l + 1}\),\(b_i = a_{l - 1 + i}\),将\(b\)排序,\(f(l,r)\)=\(\sum\limits_{i = 1}^{r - l + 1}{b_i \cdot i}\) 计算\(\left(\sum\limits_{1 \le l \le r \le n}{f(l, r)}\right) \mod (10^9+7)\) 分析 考虑每个数字对答案的贡献,首先每…
题意 题解 对于[l,r]中的一个数,不论[l,r]有多大,只有比它小的数可以影响到它的排名,那么就可以把ai从小到大排序,一个一个加入线段树中,线段树中下表为 i 的是ai(原来的位置,不是排序后的)分别为最右端和最左端时的排名总和(设为suml[i].sumr[i]),ai的总贡献就是 ai * (suml[i-1] * (n-i+1) + sumr[i] * i) 当循环到一个点 i 时,他左边的任意一个点 j 会为 l <= j 且 r >= i 的区间中 i 的排名贡献1,右边的任意…
The best programmers of Embezzland compete to develop a part of the project called "e-Government" — the system of automated statistic collecting and press analysis. We know that any of the k citizens can become a member of the Embezzland governm…
题目链接: https://codeforces.com/contest/1167/problem/F 题意: 给出长度为$n$的数组,初始每个元素为$a_i$ 定义:$f(l, r)$为,重排$l$到$r$的元素,变成长度为$(r-l+1)$的数组$b_i$,$f(l, r)=\sum\limits_{i = 1}^{r - l + 1}{b_i \cdot i}$ 求$\left(\sum\limits_{1 \le l \le r \le n}{f(l, r)}\right) \mod (…
Problem Description After inventing Turing Tree, 3xian always felt boring when solving problems about intervals, because Turing Tree could easily have the solution. As well, wily 3xian made lots of new problems about intervals. So, today, this sick t…
Necklace Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2083    Accepted Submission(s): 747 Problem Description Mery has a beautiful necklace. The necklace is made up of N magic balls. Each ba…
Attack Time Limit: 5000/3000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Others) Total Submission(s): 2523    Accepted Submission(s): 805 Problem Description Today is the 10th Annual of “September 11 attacks”, the Al Qaeda is about to attac…
Magic Ball Game Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 2489    Accepted Submission(s): 759 Problem Description When the magic ball game turns up, Kimi immediately falls in it. The int…
Super Mario Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5560    Accepted Submission(s): 2532 Problem Description Mario is world-famous plumber. His “burly” figure and amazing jumping ability…
I. Yukino With Subinterval 题目链接: Problem Descripe Yukino has an array \(a_1, a_2 \cdots a_n\). As a tsundere girl, Yukino is fond of studying subinterval. Today, she gives you four integers $l, r, x, y $, and she is looking for how many different sub…