Submission #864417

# Submission time Handle Problem Language Result Execution time Memory
864417 2023-10-22T19:58:35 Z TAhmed33 Autići (COCI22_autici) C++
50 / 50
33 ms 2140 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MAXN = 1e5 + 25;
int arr[MAXN];
signed 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 = 2; i <= n; i++) sum += arr[i];
	sum += (n - 1) * arr[1];
	cout << sum << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 14 ms 1116 KB Output is correct
3 Correct 29 ms 1108 KB Output is correct
4 Correct 25 ms 1092 KB Output is correct
5 Correct 28 ms 1116 KB Output is correct
6 Correct 24 ms 1116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 14 ms 1116 KB Output is correct
3 Correct 29 ms 1108 KB Output is correct
4 Correct 25 ms 1092 KB Output is correct
5 Correct 28 ms 1116 KB Output is correct
6 Correct 24 ms 1116 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 11 ms 1244 KB Output is correct
22 Correct 30 ms 2128 KB Output is correct
23 Correct 29 ms 2132 KB Output is correct
24 Correct 31 ms 1884 KB Output is correct
25 Correct 33 ms 2132 KB Output is correct
26 Correct 31 ms 1900 KB Output is correct
27 Correct 33 ms 1916 KB Output is correct
28 Correct 30 ms 1884 KB Output is correct
29 Correct 32 ms 2128 KB Output is correct
30 Correct 28 ms 2140 KB Output is correct