제출 #113063

#제출 시각아이디문제언어결과실행 시간메모리
113063CaQtimlAkcija (COCI15_akcija)C++14
40 / 80
39 ms1144 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+=arr[((i-1)*3)+1]; //cout << ans << "\n"; } //for(int i=(3*rob+1);i<=n;i++) ans+=arr[i]; cout << qs[n]-ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...