답안 #899500

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
899500 2024-01-06T10:23:00 Z AlphaMale06 Akcija (COCI15_akcija) C++14
80 / 80
13 ms 1788 KB
#include <bits/stdc++.h>

/*
	Oce nas,
	koji si na nebesima,
	da se sveti ime Tvoje,
	da dodje carstvo Tvoje,
	da bude volja Tvoja,
	i na zemlji, kao i na nebu.
	
	Hleb nas nasusni daj nam danas,
	i oprosti nam dugove nase,
	kao sto i mi oprastamo duznicima svojim,
	i ne uvedi nas u iskusenje,
	no izbavi nas od zloga.
	
	Jer je Tvoje Carstvo,
	i sila, i slava,
	u vekove vekova.
	
	Amin.
*/

using namespace std;
typedef vector<int> vc;
typedef vector<vector<int>> vvc;
using ll = long long;
using ld = long double;
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define F first
#define S second
#define pb push_back
#define pf push_front
#define all(x) (x).begin(), (x).end()
#define int long long

void solve(){
	int n;
	cin >> n;
	int a[n];
	for(int i=0; i< n; i++)cin >> a[i];
	sort(a, a+n);
	reverse(a, a+n);
	int ans=0;
	for(int i=0; i< n; i++){
		if(i%3!=2)ans+=a[i];
	}
	cout << ans << '\n';
}

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 10 ms 1372 KB Output is correct
7 Correct 6 ms 1372 KB Output is correct
8 Correct 6 ms 1372 KB Output is correct
9 Correct 12 ms 1628 KB Output is correct
10 Correct 13 ms 1788 KB Output is correct