Submission #531802

# Submission time Handle Problem Language Result Execution time Memory
531802 2022-03-01T14:37:27 Z hgmhc Autići (COCI22_autici) C++17
50 / 50
14 ms 2056 KB
#include <bits/stdc++.h>
using namespace std; using ii = pair<int,int>;
using ll = long long; using ld = long double;
#define _(x) const x&
#define REP(i,a,b) for (auto i = (a); i <= (b); ++i)
#define ZIP(x) (x).erase(unique((x).begin(),(x).end()),(x).end())
#define MP make_pair
#define mup(x,y) x = min(x,y)
#define Mup(x,y) x = max(x,y)
#define size(x) int((x).size())

int main() {
    cin.tie(0)->sync_with_stdio(0);
    int n; cin >> n;
    vector<ll> d(n);
    for (auto &x : d) cin >> x;
    // sort(d.begin(),d.end());
    if (n == 1) {
        cout << 0;
    }
    else {
        ll mn = 2e9;
        REP(i,0,n-1) mup(mn,d[i]);
        cout << (n-2)*mn + accumulate(d.begin(),d.end(),0LL);
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 6 ms 1164 KB Output is correct
3 Correct 13 ms 1936 KB Output is correct
4 Correct 10 ms 1816 KB Output is correct
5 Correct 11 ms 1996 KB Output is correct
6 Correct 9 ms 1740 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 220 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 6 ms 1164 KB Output is correct
3 Correct 13 ms 1936 KB Output is correct
4 Correct 10 ms 1816 KB Output is correct
5 Correct 11 ms 1996 KB Output is correct
6 Correct 9 ms 1740 KB Output is correct
7 Correct 1 ms 220 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 320 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 1 ms 308 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 6 ms 1356 KB Output is correct
22 Correct 14 ms 2056 KB Output is correct
23 Correct 12 ms 1976 KB Output is correct
24 Correct 11 ms 1856 KB Output is correct
25 Correct 11 ms 1984 KB Output is correct
26 Correct 10 ms 1920 KB Output is correct
27 Correct 10 ms 1976 KB Output is correct
28 Correct 10 ms 1860 KB Output is correct
29 Correct 11 ms 1944 KB Output is correct
30 Correct 13 ms 1996 KB Output is correct