Skip to content

Commit 4f219f3

Browse files
committed
[BOJ] #14698. 전생했더니 슬라임 연구자였던 것에 대하여(Hard) / 골드4 / 20분 / 성공
1 parent 8a826d6 commit 4f219f3

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import sys
2+
import heapq
3+
input = sys.stdin.readline
4+
5+
T = int(input())
6+
for _ in range(T):
7+
total = 1
8+
N = int(input())
9+
heap = list(map(int, input().split()))
10+
if N == 1:
11+
print(1)
12+
continue
13+
14+
heapq.heapify(heap)
15+
16+
while len(heap) > 1:
17+
energy = heapq.heappop(heap) * heapq.heappop(heap)
18+
total *= energy
19+
heapq.heappush(heap, energy)
20+
21+
print(total % 1000000007)

0 commit comments

Comments
 (0)