結果
| 問題 |
No.2835 Take and Flip
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-08-09 21:57:33 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 141 ms / 2,000 ms |
| コード長 | 210 bytes |
| コンパイル時間 | 148 ms |
| コンパイル使用メモリ | 82,424 KB |
| 実行使用メモリ | 105,728 KB |
| 最終ジャッジ日時 | 2024-08-09 21:57:37 |
| 合計ジャッジ時間 | 3,688 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
x = 0
y = 0
for i in range(N//2):
x+=A[i]
y+=A[N-1-i]
if N%2==1:
x+=A[N//2]
print(x+y)