Submission #113072

# Submission time Handle Problem Language Result Execution time Memory
113072 2019-05-23T13:50:15 Z CaQtiml Akcija (COCI15_akcija) C++14
80 / 80
36 ms 1016 KB
#include "bits/stdc++.h"
using namespace std;
int arr[(int)1e5+10];
long long sum;
int main()
{
	int n;
	cin >> n;
	int rob = n/3;
	for(int i=1;i<=n;i++) 
	{
		cin >> arr[i];
		sum+=arr[i];
	}
	sort(arr+1,arr+1+n);
	long long ans=0;
	for(int i=n-2;i>=1;i-=3)
	{
		ans+=arr[i];
		//cout << ans << "\n";
	}
	//for(int i=(3*rob+1);i<=n;i++) ans+=arr[i];
	cout << sum-ans;
}

Compilation message

akcija.cpp: In function 'int main()':
akcija.cpp:9:6: warning: unused variable 'rob' [-Wunused-variable]
  int rob = n/3;
      ^~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 356 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 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 27 ms 928 KB Output is correct
7 Correct 23 ms 892 KB Output is correct
8 Correct 24 ms 1016 KB Output is correct
9 Correct 35 ms 888 KB Output is correct
10 Correct 36 ms 892 KB Output is correct