# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
153848 | 2019-09-17T04:55:31 Z | Ruxandra985 | Akcija (COCI15_akcija) | C++14 | 23 ms | 1272 KB |
#include <cstdio> #include <algorithm> #include <set> using namespace std; int v[100010]; int main() { FILE *fin = stdin; FILE *fout = stdout; int n,i; long long sol = 0; fscanf (fin,"%d",&n); for (i=1;i<=n;i++) fscanf(fin,"%d",&v[i]); sort ( v + 1 , v + n + 1); for (i=n;i>0;i-=3){ if (i - 2>0) sol = sol + v[i] + v[i-1]; else{ sol = sol + v[i]; if (i-1>0) sol = sol + v[i-1]; } } fprintf (fout,"%lld",sol); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 380 KB | Output is correct |
6 | Correct | 19 ms | 996 KB | Output is correct |
7 | Correct | 13 ms | 1016 KB | Output is correct |
8 | Correct | 13 ms | 1144 KB | Output is correct |
9 | Correct | 23 ms | 1272 KB | Output is correct |
10 | Correct | 23 ms | 1272 KB | Output is correct |