답안 #895782

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
895782 2023-12-30T20:22:58 Z Isam Autići (COCI22_autici) C++17
10 / 50
11 ms 1744 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;
	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){
      |                   ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 5 ms 860 KB Output is correct
3 Correct 9 ms 1744 KB Output is correct
4 Correct 8 ms 1624 KB Output is correct
5 Correct 9 ms 1624 KB Output is correct
6 Correct 11 ms 1648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Incorrect 0 ms 472 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 5 ms 860 KB Output is correct
3 Correct 9 ms 1744 KB Output is correct
4 Correct 8 ms 1624 KB Output is correct
5 Correct 9 ms 1624 KB Output is correct
6 Correct 11 ms 1648 KB Output is correct
7 Correct 0 ms 348 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 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Incorrect 0 ms 472 KB Output isn't correct
13 Halted 0 ms 0 KB -