Submission #165815

#TimeUsernameProblemLanguageResultExecution timeMemory
165815Abdulaziz_KazimAkcija (COCI15_akcija)C++17
80 / 80
60 ms760 KiB
#include<bits/stdc++.h> using namespace std; int main() { // freopen("a.gir","r",stdin); // freopen("a.cik","w",stdout); int n; int dizi[100007]; cin >> n; for(int i=0;i<n;i++) { cin >> dizi[i]; } sort(dizi,dizi+n); long long int fiyat=0; int i; for(i=0;i<n%3;i++) { fiyat+=dizi[i]; } for(;i<n-2;i+=3) { fiyat+=dizi[i+1]+dizi[i+2]; } cout << fiyat; }
#Verdict Execution timeMemoryGrader output
Fetching results...