Submission #641240

#TimeUsernameProblemLanguageResultExecution timeMemory
641240lto5Autići (COCI22_autici)C++14
50 / 50
17 ms1716 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; vector <int> a(n); for (int &i: a) cin >> i; sort(a.begin(), a.end()); long long ans = 0; for (int i = 1; i < a.size(); i++) ans += a.front() + a[i]; cout << ans; return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:20:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |   for (int i = 1; i < a.size(); i++)
      |                   ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...