RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
USACO0649

Shock Wave

Diamond III 다이아몬드 III
난이도
2s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

Bessie is experimenting with a powerful hoof implant that has the ability to
create massive shock waves. She has \(N\) (\(2 \leq N \leq 10^5\)) tiles lined up in
front of her, which require powers of at least \(p_0,p_1,\dots,p_{N-1}\) to break,
respectively
(\(0 \leq p_i \leq 10^{18}\)).

Bessie can apply power by punching a specific tile but due to the strange nature
of her implant, it will not apply any power to the tile she punches. Instead, if
she chooses to punch tile \(x\) once, where \(x\) is an integer in \([0,N-1]\),
it applies \(|i-x|\) power to tile \(i\) for all integers \(i\) in the range
\([0,N-1]\). This power is also cumulative, so applying \(2\) power twice to a tile
will apply a total of \(4\) power to the tile.

Please determine the fewest number of punches required to break all the tiles.

Problem credits: Suhas Nagar

제약

SCORING

  • Input 2: All \(p_i\) are equal.
  • Inputs 3-6: \(N\le 100\)
  • Inputs 7-14: No additional constraints.

Problem credits: Suhas Nagar

입력 형식

The first line contains \(T\) (\(1 \leq T \leq 100\)) representing the number of
test cases.

Line \(2t\) contains a single integer \(N\), the number of tiles in test case \(t\).

Line \(2t+1\) contains \(N\) space separated numbers \(p_0,p_1, \ldots, p_{N-1}\) representing
that tile \(i\) takes \(p_i\) power to be broken.

It is guaranteed that the sum of all \(N\) in a single input does not exceed
\(5\cdot 10^5\).

출력 형식

\(T\) lines, the \(i\)th line representing the answer to the \(i\)th test case.

예제 1
입력
6
5
0 2 4 5 8
5
6 5 4 5 6
5
1 1 1 1 1
5
12 10 8 6 4
7
6 1 2 3 5 8 13
2
1000000000000000000 1000000000000000000
출력
2
3
2
4
4
2000000000000000000
설명

For the first test, the only way for Bessie to break all the tiles with two
punches is to punch \(0\) twice, applying total powers of \([0,2,4,6,8]\)
respectively.

For the second test, one way for Bessie to break all the tiles with three
punches is to punch \(0\), \(2\), and \(4\) one time each, applying total powers of
\([6,5,4,5,6]\) respectively.

For the third test, one way for Bessie to break all the tiles with two punches
is to punch \(0\) and \(1\) one time each, applying total powers of \([1,1,3,5,7]\)
respectively.

문제 정보

riseoj 작성

출처 올림피아드 > USACO > 2024-2025 > January > Platinum

태그

평가 및 의견

Shock Wave

개요
출제자 난이도 Diamond III 다이아몬드 III 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Shock Wave

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8