Submission #532354

#TimeUsernameProblemLanguageResultExecution timeMemory
532354Alex_tz307Autići (COCI22_autici)C++17
50 / 50
13 ms1296 KiB
#include <bits/stdc++.h>
#define int long long
#define INF 0x3f3f3f3f

using namespace std;

void testCase() {
  int n;
  cin >> n;
  int sum = 0, mn = INF;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    sum += x;
    mn = min(mn, x);
  }
  cout << sum + mn * (n - 2) << '\n';
}

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int tests = 1;
  for (int tc = 0; tc < tests; ++tc) {
    testCase();
  }
  return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...