Submission #895783

# Submission time Handle Problem Language Result Execution time Memory
895783 2023-12-30T20:27:52 Z Isam Autići (COCI22_autici) C++17
10 / 50
9 ms 828 KB
#include<bits/stdc++.h>
using namespace std;
constexpr int sz = 100005;

int n;
int d[sz];

signed main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n;
	unsigned long long sm(0);
	for(register int i = 1; i <= n; ++i){
		cin >> d[i];
		sm += d[i];
	}
	if(n == 1) return puts("0"), 0;
	sort(d+1, d+n+1);
	sm <<= 1;
	sm -= (d[n] + d[n - 1]);
	cout << sm << '\n';
	return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:12:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   12 |  for(register int i = 1; i <= n; ++i){
      |                   ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 5 ms 604 KB Output is correct
3 Correct 8 ms 816 KB Output is correct
4 Correct 8 ms 828 KB Output is correct
5 Correct 8 ms 604 KB Output is correct
6 Correct 9 ms 604 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 0 ms 348 KB Output is correct
6 Incorrect 1 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 5 ms 604 KB Output is correct
3 Correct 8 ms 816 KB Output is correct
4 Correct 8 ms 828 KB Output is correct
5 Correct 8 ms 604 KB Output is correct
6 Correct 9 ms 604 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 0 ms 348 KB Output is correct
12 Incorrect 1 ms 348 KB Output isn't correct
13 Halted 0 ms 0 KB -