Submission #762580

#TimeUsernameProblemLanguageResultExecution timeMemory
762580KN200711Akcija (COCI15_akcija)C++14
80 / 80
15 ms1620 KiB
# 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 (stderr)

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