답안 #634014

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
634014 2022-08-23T16:28:36 Z ahmed_shafik Akcija (COCI15_akcija) C++17
80 / 80
16 ms 1620 KB
#include <bits/stdc++.h>
#define ahmed_is_fast             \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
#define ll long long
#define ld long double
#define cc(n) cout << n << "\n"
#define ccc(n) cout << n << ' '
#define endl "\n"
#define all(v) v.begin(), v.end()
#define mx(a, b) a = max(a, b)
#define mn(a, b) a = min(a, b)
#define mem(a, b) memset(a, b, sizeof(a))
#define f(a) a.first
#define s(a) a.second
#define lcm(a, b) (a * b) / __gcd(a, b)
#define sp(x) setprecision(x)
using namespace std;
void ahmed()
{
    ll n;
    cin>>n;
    ll arr[n+9];
    for(ll i=0; i<n; i++)
    {
        cin>>arr[i];
    }
    sort(arr,arr+n);
    reverse(arr,arr+n);
    ll sum=0;
    for(ll i=0; i<n; i++)
    {
        ll x=i+1;
        if(x%3!=0)
        {
            sum+=arr[i];
        }
    }
    cout<<sum<<endl;
}
bool AHMED = false;
int main()
{
    ahmed_is_fast;
    ll t = 1;
    if (AHMED)
    {
        cin >> t;
    }
    while (t--)
    {
        ahmed();
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 16 ms 1468 KB Output is correct
7 Correct 12 ms 1468 KB Output is correct
8 Correct 8 ms 1496 KB Output is correct
9 Correct 15 ms 1620 KB Output is correct
10 Correct 15 ms 1620 KB Output is correct