답안 #864415

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
864415 2023-10-22T19:53:12 Z TAhmed33 Autići (COCI22_autici) C++
10 / 50
30 ms 1628 KB
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 25;
int arr[MAXN];
int main () {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> arr[i];
	if (n == 1) {
		cout << "0\n";
		return 0;
	}
	long long sum = 0;
	sort(arr + 1, arr + n + 1);
	for (int i = 1; i < n - 1; i++) sum += 2 * arr[i];
	sum += arr[n - 1] + arr[n];
	cout << sum << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 11 ms 860 KB Output is correct
3 Correct 29 ms 1628 KB Output is correct
4 Correct 25 ms 1620 KB Output is correct
5 Correct 30 ms 1620 KB Output is correct
6 Correct 24 ms 1368 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 500 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 456 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Incorrect 1 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 11 ms 860 KB Output is correct
3 Correct 29 ms 1628 KB Output is correct
4 Correct 25 ms 1620 KB Output is correct
5 Correct 30 ms 1620 KB Output is correct
6 Correct 24 ms 1368 KB Output is correct
7 Correct 0 ms 500 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 456 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Incorrect 1 ms 348 KB Output isn't correct
13 Halted 0 ms 0 KB -