Submission #881206

#TimeUsernameProblemLanguageResultExecution timeMemory
881206Youssif_ElkadiAutići (COCI22_autici)C++17
50 / 50
31 ms2196 KiB
#include <bits/stdc++.h> using namespace std; const long long N = 2e5 + 5, inf = 1e17 + 5, mod = 1e9 + 7; int main() { int n; cin >> n; long long ans = 0; long long mn = inf, ind; vector<long long> arr(n); for (int i = 0; i < n; i++) { cin >> arr[i]; if (arr[i] < mn) mn = arr[i], ind = i; } for (int i = 0; i < n; i++) { if (ind == i) continue; ans += mn + arr[i]; } cout << ans; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:19:3: warning: 'ind' may be used uninitialized in this function [-Wmaybe-uninitialized]
   19 |   if (ind == i)
      |   ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...