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

A. Atomic Energy

설명

The Next Wave Energy Research Club is looking at several atoms as potential energy sources, and has asked you to do some computations to see which are the most promising.

Although an atom is composed of various parts, for the purposes of this method only the number of neutrons in the atom is relevantIn fact, for this problem you might want to forget everything you thought you knew about chemistry.. In the method, a laser charge is fired at the atom, which then releases energy in a process formally called explodification. Exactly how this process proceeds depends on the number of neutrons \(k\):
- If the atom contains \(k \leq n\) neutrons, it will be converted into \(a_k\) joules of energy.
- If the atom contains \(k > n\) neutrons, it will decompose into two atoms with \(i\) and \(j\) neutrons respectively, satisfying \(i,j \geq 1\) and \(i+j=k\). These two atoms will then themselves explodificate.

When an atom with \(k\) neutrons is explodificated, the total energy that is released depends on the exact sequence of decompositions that occurs in the explodification process. Modern physics is not powerful enough to predict exactly how an atom will decompose—however, for explodification to be a reliable energy source, we need to know the minimum amount of energy that it can release upon explodification. You have been tasked with computing this quantity.

제약
입력 형식

The input consists of:
- One line with two integers \(n\) and \(q\) (\(1 \leq n \leq 100\), \(1 \leq q \leq 10^5\)), the neutron threshold and the number of experiments.
- One line with \(n\) integers \(a_1,\ldots,a_n\) (\(1 \leq a_i \leq 10^9\) for each \(i\)), where \(a_i\) is the amount of energy released when an atom with \(i\) neutrons is explodificated.
- Then \(q\) lines follow, each with an integer \(k\) (\(1 \leq k \leq 10^9\)), asking for the minimum energy released when an atom with \(k\) neutrons is explodificated.

출력 형식

For each query \(k\), output the minimum energy released when an atom with \(k\) neutrons is explodificated.

예제 1
입력
4 5
2 3 5 7
2
3
5
6
8
출력
3
5
8
10
13
예제 2
입력
1 3
10
1
2
100
출력
10
20
1000
문제 정보

생성자가 기록되지 않았습니다.

출처 ICPC NWERC 2020

평가 및 의견

A. Atomic Energy

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

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

풀이 제출

A. Atomic Energy

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