Logo
(追記) (追記ここまで)

33311번 - Subsequence Update 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1.5 초 2048 MB139847967.521%

문제

After Little John borrowed expansion screws from auntie a few hundred times, eventually she decided to come and take back the unused ones.

But as they are a crucial part of home design, Little John decides to hide some in the most unreachable places --- under the eco-friendly wood veneers.

You are given an integer sequence $a_1, a_2, \ldots, a_n,ドル and a segment $[l,r]$ (1ドル \le l \le r \le n$).

You must perform the following operation on the sequence exactly once.

  • Choose any subsequence1 of the sequence $a,ドル and reverse it. Note that the subsequence does not have to be contiguous.

Formally, choose any number of indices $i_1,i_2,\ldots,i_k$ such that 1ドル \le i_1 < i_2 < \ldots < i_k \le n$. Then, change the $i_x$-th element to the original value of the $i_{k-x+1}$-th element simultaneously for all 1ドル \le x \le k$.

Find the minimum value of $a_l+a_{l+1}+\ldots+a_{r-1}+a_r$ after performing the operation.


1A sequence $b$ is a subsequence of a sequence $a$ if $b$ can be obtained from $a$ by the deletion of several (possibly, zero or all) element from arbitrary positions.

입력

Each test contains multiple test cases. The first line contains the number of test cases $t$ (1ドル \le t \le 10^4$). The description of the test cases follows.

The first line of each test case contains three integers $n,ドル $l,ドル $r$ (1ドル \le l \le r \le n \le 10^5$) --- the length of $a,ドル and the segment $[l,r]$.

The second line of each test case contains $n$ integers $a_1,a_2,\ldots,a_n$ (1ドル \le a_{i} \le 10^9$).

It is guaranteed that the sum of $n$ over all test cases does not exceed 10ドル^5$.

출력

For each test case, output the minimum value of $a_l+a_{l+1}+\ldots+a_{r-1}+a_r$ on a separate line.

제한

예제 입력 1

6
2 1 1
2 1
3 2 3
1 2 3
3 1 3
3 1 2
4 2 3
1 2 2 2
5 2 5
3 3 2 3 5
6 1 3
3 6 6 4 3 2

예제 출력 1

1
3
6
3
11
8

노트

On the second test case, the array is $a=[1,2,3]$ and the segment is $[2,3]$.

After choosing the subsequence $a_1,a_3$ and reversing it, the sequence becomes $[3,2,1]$. Then, the sum $a_2+a_3$ becomes 3ドル$. It can be shown that the minimum possible value of the sum is 3ドル$.

출처

Contest > Codeforces > Codeforces Round 1000 (Div. 2) B번

  • 문제를 만든 사람: Yugandhar_Master
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /