Submission #762580

# Submission time Handle Problem Language Result Execution time Memory
762580 2023-06-21T14:09:37 Z KN200711 Akcija (COCI15_akcija) C++14
80 / 80
15 ms 1620 KB
# include <bits/stdc++.h>
# define ll long long
using namespace std;

int main() {
	int N;
	scanf("%d", &N);
	
	vector<ll> arr(N);
	for(int i=0;i<N;i++) scanf("%lld", &arr[i]);
	sort(arr.begin(), arr.end());
	
	int cnt = 0;
	ll ans = 0ll;
	for(int i=N-1;i>=0;i--) {
		cnt++;
		if(cnt%3 != 0) ans += arr[i];  
	}
	
	printf("%lld\n", ans);
	return 0;
}

Compilation message

akcija.cpp: In function 'int main()':
akcija.cpp:7:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |  scanf("%d", &N);
      |  ~~~~~^~~~~~~~~~
akcija.cpp:10:28: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |  for(int i=0;i<N;i++) scanf("%lld", &arr[i]);
      |                       ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 296 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 13 ms 1364 KB Output is correct
7 Correct 8 ms 1464 KB Output is correct
8 Correct 8 ms 1484 KB Output is correct
9 Correct 15 ms 1620 KB Output is correct
10 Correct 13 ms 1592 KB Output is correct