Submission #708985

# Submission time Handle Problem Language Result Execution time Memory
708985 2023-03-13T03:33:57 Z vjudge1 Akcija (COCI15_akcija) C++17
80 / 80
18 ms 1108 KB
#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;

#define int long long
#define ll long long
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define freopen(x) freopen(x".in","r",stdin);freopen(x".out","w",stdout);

const int N = 1e6 + 5;
const int M = 3e3 + 5;
const ll mod = 1e9 + 7;
const ll inf = 1e7;

long long n, c[N], cnt, ans;

main() {
	fast
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> c[i];
	}
	sort(c + 1, c + 1 + n);
	for(int i = n; i >= 1; i--){
		cnt++;
		if(cnt % 3 != 0){
			ans += c[i];
		}
	}
	cout << ans;
}

Compilation message

akcija.cpp:3: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    3 | #pragma GCC optimization("O3")
      | 
akcija.cpp:4: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    4 | #pragma GCC optimization("unroll-loops")
      | 
akcija.cpp:5: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
    5 | #pragma comment(linker, "/stack:200000000")
      | 
akcija.cpp:26:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   26 | main() {
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 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 212 KB Output is correct
6 Correct 16 ms 996 KB Output is correct
7 Correct 8 ms 1108 KB Output is correct
8 Correct 8 ms 1088 KB Output is correct
9 Correct 16 ms 1108 KB Output is correct
10 Correct 18 ms 1108 KB Output is correct