# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
524493 | Adominator | Akcija (COCI15_akcija) | C++17 | 17 ms | 1592 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ar array
#define vo vector
#define pb push_back
#define all(x) begin(x), end(x)
#define sz(x) (ll)(x).size()
#define rep(i, a, b) for(ll i=a; i<b; i++)
#define repd(i, a, b) for(ll i=a; i>=b; i--)
int main() {
cin.tie(0)->sync_with_stdio(0);
ll n;
cin >> n;
vo<ll> A(n);
rep(i, 0, n)
cin >> A[i];
sort(all(A)); ll ans=0;
while(sz(A)>=3) {
ans+=A.back();
A.pop_back();
ans+=A.back();
A.pop_back();
A.pop_back();
}
for(auto i: A)
ans+=i;
cout << ans << "\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |