# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
98759 |
2019-02-25T16:13:31 Z |
M_H_H_7 |
Akcija (COCI15_akcija) |
C++14 |
|
25 ms |
1664 KB |
//In The Name of Beauty
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define IB std::ios::sync_with_stdio(0);
#define pb(x) push_back(x);
#define mp(x,y) make_pair(x,y)
#define pll pair<ll,ll>
#define F first
#define S second
ll const MAXN = 1e5 + 8;
ll const INF = 1e12 + 8;
ll const delta = 1000000007;
int main()
{
IB;
cin.tie(0);
cout.tie(0);
ll n;
cin >> n;
ll a[n];
ll ans = 0;
for(ll i = 0;i < n;i++)cin >> a[i];
sort(a,a + n);
ll i = 0;
if(n % 3 == 1)ans += a[0],i++;
if(n % 3 == 2)ans += a[1],i++;
for(i;i < n;i += 3)ans += (a[i + 1] + a[i + 2]);
cout << ans;
return 0;
}
//Written by M_H_H_7
Compilation message
akcija.cpp: In function 'int main()':
akcija.cpp:30:10: warning: statement has no effect [-Wunused-value]
for(i;i < n;i += 3)ans += (a[i + 1] + a[i + 2]);
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
512 KB |
Output isn't correct |
2 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
3 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
384 KB |
Output is correct |
6 |
Correct |
15 ms |
1536 KB |
Output is correct |
7 |
Correct |
13 ms |
1536 KB |
Output is correct |
8 |
Correct |
17 ms |
1536 KB |
Output is correct |
9 |
Correct |
20 ms |
1664 KB |
Output is correct |
10 |
Incorrect |
25 ms |
1664 KB |
Output isn't correct |