Submission #14992146


Source Code Expand

Copy
import sys
from collections import deque

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, *A = map(int, read().split())

A.sort(reverse=True)

deq = deque([A[0]])
ans = 0
for x in A[1:]:
    ans += deq.popleft()
    deq.append(x)
    deq.append(x)

print(ans)

Submission Info

Submission Time
Task D - Chat in a Circle
User maspy
Language Python (3.8.2)
Score 400
Code Size 338 Byte
Status
Exec Time 197 ms
Memory 29440 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt
Subtask1 400 / 400 sample_01.txt, sample_02.txt, sub1_01.txt, sub1_02.txt, sub1_03.txt, sub1_04.txt, sub1_05.txt, sub1_06.txt, sub1_07.txt, sub1_08.txt, sub1_09.txt, sub1_10.txt, sub1_11.txt, sub1_12.txt, sub1_13.txt, sub1_14.txt, sub1_15.txt, sub1_16.txt, sub1_17.txt, sub1_18.txt, sub1_19.txt, sub1_20.txt, sub1_21.txt, sub1_22.txt, sub1_23.txt, sub1_24.txt, sub1_25.txt, sub1_26.txt, sub1_27.txt, sub1_28.txt, sub1_29.txt, sub1_30.txt, sub1_31.txt
Case Name Status Exec Time Memory
sample_01.txt 25 ms 9168 KB
sample_02.txt 25 ms 9172 KB
sub1_01.txt 57 ms 13988 KB
sub1_02.txt 125 ms 21432 KB
sub1_03.txt 102 ms 20064 KB
sub1_04.txt 44 ms 11668 KB
sub1_05.txt 57 ms 12628 KB
sub1_06.txt 143 ms 23464 KB
sub1_07.txt 118 ms 29352 KB
sub1_08.txt 123 ms 29200 KB
sub1_09.txt 141 ms 24872 KB
sub1_10.txt 44 ms 11484 KB
sub1_11.txt 86 ms 18356 KB
sub1_12.txt 148 ms 25524 KB
sub1_13.txt 141 ms 27212 KB
sub1_14.txt 39 ms 10192 KB
sub1_15.txt 72 ms 18056 KB
sub1_16.txt 107 ms 22020 KB
sub1_17.txt 120 ms 29368 KB
sub1_18.txt 164 ms 29376 KB
sub1_19.txt 117 ms 29200 KB
sub1_20.txt 151 ms 29204 KB
sub1_21.txt 184 ms 29336 KB
sub1_22.txt 125 ms 29192 KB
sub1_23.txt 166 ms 29376 KB
sub1_24.txt 118 ms 29208 KB
sub1_25.txt 163 ms 29352 KB
sub1_26.txt 197 ms 29440 KB
sub1_27.txt 29 ms 9160 KB
sub1_28.txt 27 ms 9176 KB
sub1_29.txt 118 ms 29196 KB
sub1_30.txt 124 ms 21352 KB
sub1_31.txt 91 ms 17048 KB