답안 #628833

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
628833 2022-08-13T18:00:08 Z vovamr Autići (COCI22_autici) C++17
50 / 50
75 ms 1640 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fi first
#define se second
#define ll long long
#define ld long double
#define sz(x) ((int)(x).size())
#define all(x) 	(x).begin(), (x).end()
#define pb push_back
#define mpp make_pair
#define ve vector
using namespace std;
using namespace __gnu_pbds;
template<class T> using oset = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
const ll inf = 1e18; const int iinf = 1e9;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T> inline bool chmin(T& a, T b) { return (a > b ? a = b, 1 : 0); }
template <typename T> inline bool chmax(T& a, T b) { return (a < b ? a = b, 1 : 0); }

inline void solve() {
	int n;
	cin >> n;
	ve<int> a(n);
	for (auto &i : a) cin >> i;

	ll ans = 0;
	sort(all(a));
	for (int i = 1; i < n; ++i) ans += a[i] + a[0];
	cout << ans;
}

signed main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int q = 1; // cin >> q;
	while (q--) solve();
	cerr << fixed << setprecision(3) << "Time execution: " << (double)clock() / CLOCKS_PER_SEC << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 11 ms 596 KB Output is correct
3 Correct 14 ms 596 KB Output is correct
4 Correct 12 ms 596 KB Output is correct
5 Correct 12 ms 724 KB Output is correct
6 Correct 10 ms 596 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 328 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 11 ms 596 KB Output is correct
3 Correct 14 ms 596 KB Output is correct
4 Correct 12 ms 596 KB Output is correct
5 Correct 12 ms 724 KB Output is correct
6 Correct 10 ms 596 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 328 KB Output is correct
19 Correct 1 ms 320 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 10 ms 852 KB Output is correct
22 Correct 14 ms 1620 KB Output is correct
23 Correct 22 ms 1588 KB Output is correct
24 Correct 75 ms 1560 KB Output is correct
25 Correct 18 ms 1620 KB Output is correct
26 Correct 16 ms 1492 KB Output is correct
27 Correct 38 ms 1640 KB Output is correct
28 Correct 20 ms 1448 KB Output is correct
29 Correct 19 ms 1608 KB Output is correct
30 Correct 15 ms 1620 KB Output is correct