Submission #154214

#TimeUsernameProblemLanguageResultExecution timeMemory
154214KCSCAkcija (COCI15_akcija)C++14
0 / 80
2 ms380 KiB
#include <bits/stdc++.h> using namespace std; const int DIM = 100005; int arr[DIM]; int main(void) { freopen("b.in", "r", stdin); freopen("b.out", "w", stdout); int n; cin >> n; long long ans = 0; for (int i = 1; i <= n; ++i) { cin >> arr[i]; ans += arr[i]; } sort(arr + 1, arr + n + 1); for (int i = n - 2; i >= 1; i -= 3) ans -= arr[i]; cout << ans; return 0; }

Compilation message (stderr)

akcija.cpp: In function 'int main()':
akcija.cpp:9:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("b.in", "r", stdin);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~
akcija.cpp:10:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("b.out", "w", stdout);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...