Submission #956172

#TimeUsernameProblemLanguageResultExecution timeMemory
956172lalig777Akcija (COCI15_akcija)C++14
80 / 80
25 ms1372 KiB
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <iostream> #include <vector> #include <algorithm> using namespace std; typedef long long int ll; int main(){ int n; cin>>n; ll sum=0; vector<int>v(n); for (int i=0; i<n; i++){ cin>>v[i]; sum+=v[i]; }sort(v.begin(), v.end()); for (int i=n-3; i>=0; i-=3) sum-=v[i]; cout<<sum<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...