Submission #931888

# Submission time Handle Problem Language Result Execution time Memory
931888 2024-02-22T14:11:35 Z hugsfromadicto Akcija (COCI15_akcija) C++14
80 / 80
13 ms 1808 KB
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int mxN = 1e5 + 1;
int a[mxN], b[mxN];

void _()
{
    int n;
    cin >> n;
    for(int i = 0; i < n; ++i)
        cin >> a[i];
    sort(a,a + n, greater<int>());
    int sum = 0;
    for(int i = 0; i < n; ++i)
    {
        if(i % 3 == 0 or i % 3 == 1)
            sum += a[i];
    }
    cout << sum;
}

main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);

  int tc = 1;
  while(tc--)
  {
      _();
  }

}


Compilation message

akcija.cpp:24:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   24 | main()
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 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 0 ms 348 KB Output is correct
6 Correct 10 ms 1624 KB Output is correct
7 Correct 6 ms 1628 KB Output is correct
8 Correct 6 ms 1624 KB Output is correct
9 Correct 13 ms 1628 KB Output is correct
10 Correct 13 ms 1808 KB Output is correct