제출 #113062

#제출 시각아이디문제언어결과실행 시간메모리
113062CaQtimlAkcija (COCI15_akcija)C++14
16 / 80
35 ms1152 KiB
#include "bits/stdc++.h" using namespace std; int arr[(int)1e5+10]; int qs[(int)1e5+10]; int main() { int n; cin >> n; int rob = n/3; for(int i=1;i<=n;i++) { cin >> arr[i]; qs[i]=qs[i-1]+arr[i]; } sort(arr+1,arr+1+n); long long ans=0; for(int i=1;i<=rob;i++) { ans+=(qs[i*3]-qs[i*3-2]); //cout << ans << "\n"; } for(int i=(3*rob+1);i<=n;i++) ans+=arr[i]; cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...