Submission #98759

#TimeUsernameProblemLanguageResultExecution timeMemory
98759M_H_H_7Akcija (COCI15_akcija)C++14
56 / 80
25 ms1664 KiB
//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 (stderr)

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 timeMemoryGrader output
Fetching results...